本文整理汇总了Python中datalad.support.gitrepo.GitRepo.get_deleted_files方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepo.get_deleted_files方法的具体用法?Python GitRepo.get_deleted_files怎么用?Python GitRepo.get_deleted_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo.get_deleted_files方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_missing
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import get_deleted_files [as 别名]
def test_get_missing(path):
repo = GitRepo(path, create=True)
os.makedirs(op.join(path, 'deep'))
with open(op.join(path, 'test1'), 'w') as f:
f.write('some')
with open(op.join(path, 'deep', 'test2'), 'w') as f:
f.write('some more')
# no files tracked yet, so nothing changed
eq_(repo.get_changed_files(), [])
repo.add('.')
# still no differences between worktree and staged
eq_(repo.get_changed_files(), [])
eq_(set(repo.get_changed_files(staged=True)),
{'test1', op.join('deep', 'test2')})
eq_(set(repo.get_changed_files(staged=True, diff_filter='AD')),
{'test1', op.join('deep', 'test2')})
eq_(repo.get_changed_files(staged=True, diff_filter='D'), [])
repo.commit()
eq_(repo.get_changed_files(), [])
eq_(repo.get_changed_files(staged=True), [])
ok_clean_git(path, annex=False)
unlink(op.join(path, 'test1'))
eq_(repo.get_missing_files(), ['test1'])
rmtree(op.join(path, 'deep'))
eq_(sorted(repo.get_missing_files()), [op.join('deep', 'test2'), 'test1'])
# nothing is actually known to be deleted
eq_(repo.get_deleted_files(), [])
# do proper removal
repo.remove(op.join(path, 'test1'))
# no longer missing
eq_(repo.get_missing_files(), [op.join('deep', 'test2')])
# but deleted
eq_(repo.get_deleted_files(), ['test1'])