本文整理匯總了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)