本文整理汇总了Python中datalad.support.gitrepo.GitRepo._get_files_history方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepo._get_files_history方法的具体用法?Python GitRepo._get_files_history怎么用?Python GitRepo._get_files_history使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo._get_files_history方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_GitRepo__get_files_history
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import _get_files_history [as 别名]
def test_GitRepo__get_files_history(path):
gr = GitRepo(path, create=True)
gr.add('d1')
gr.commit("commit d1")
#import pdb; pdb.set_trace()
gr.add(['d2', 'file'])
gr.commit("commit d2")
# commit containing files of d1
d1_commit = next(gr._get_files_history([op.join(path, 'd1', 'f1'), op.join(path, 'd1', 'f1')]))
eq_(str(d1_commit.message), 'commit d1\n')
# commit containing files of d2
d2_commit_gen = gr._get_files_history([op.join(path, 'd2', 'f1'), op.join(path, 'd2', 'f1')])
eq_(str(next(d2_commit_gen).message), 'commit d2\n')
assert_raises(StopIteration, next, d2_commit_gen) # no more commits with files of d2
# union of commits containing passed objects
commits_union = gr._get_files_history([op.join(path, 'd1', 'f1'), op.join(path, 'd2', 'f1'), op.join(path, 'file')])
eq_(str(next(commits_union).message), 'commit d2\n')
eq_(str(next(commits_union).message), 'commit d1\n')
assert_raises(StopIteration, next, commits_union)
# file2 not commited, so shouldn't exist in commit history
no_such_commits = gr._get_files_history([op.join(path, 'file2')])
assert_raises(StopIteration, next, no_such_commits)