clean.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:autograder 作者: robertu94 项目源码 文件源码
def clean_hg(settings, student):
    """
    cleans a Mercurial repository with the latest submission
    """
    LOGGER.info("Using hg to clean up the directory for student %s", student['username'])

    #Remove all untracked files and directories
    #Override all options to enable the purge extension to clean the directory
    cmd = "hg --config='extensions.purge=' purge --all --dirs --files"
    timeout = int(settings['clean']['timeout']) or 5

    subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
                          shell=True, timeout=timeout, cwd=student['directory'])

    #Undo any changes to tracked files made since the last commit
    cmd = "hg update -C"
    timeout = int(settings['clean']['timeout']) or 5

    subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
                          shell=True, timeout=timeout, cwd=student['directory'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号