本文整理汇总了Python中datalad.support.gitrepo.GitRepo.git_commit方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepo.git_commit方法的具体用法?Python GitRepo.git_commit怎么用?Python GitRepo.git_commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo.git_commit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_GitRepo_commit
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import git_commit [as 别名]
def test_GitRepo_commit(path):
gr = GitRepo(path)
filename = "test_git_add.dat"
with open(os.path.join(path, filename), 'w') as f:
f.write("File to add to git")
gr.git_add(filename)
gr.git_commit("Testing GitRepo.git_commit().")
ok_clean_git(path, annex=False, untracked=[])
示例2: test_install_plain_git
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import git_commit [as 别名]
def test_install_plain_git(src, path):
# make plain git repo
gr = GitRepo(src, create=True)
gr.git_add('test.txt')
gr.git_commit('demo')
# now install it somewhere else
ds = install(path=path, source=src)
# stays plain Git repo
ok_(isinstance(ds.repo, GitRepo))
# now go back to original
ds = Dataset(src)
ok_(isinstance(ds.repo, GitRepo))
# installing a file must fail, as we decided not to perform magical upgrades
# GitRepo -> AnnexRepo
assert_raises(RuntimeError, ds.install, path='test2.txt', source=opj(src, 'test2.txt'))
# but works when forced
ifiles = ds.install(path='test2.txt', source=opj(src, 'test2.txt'), add_data_to_git=True)
ok_startswith(ifiles, ds.path)
ok_(ifiles.endswith('test2.txt'))
ok_('test2.txt' in ds.repo.get_indexed_files())