本文整理匯總了Python中datalad.support.gitrepo.GitRepo.update_remote方法的典型用法代碼示例。如果您正苦於以下問題:Python GitRepo.update_remote方法的具體用法?Python GitRepo.update_remote怎麽用?Python GitRepo.update_remote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo.update_remote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_GitRepo_remote_update
# 需要導入模塊: from datalad.support.gitrepo import GitRepo [as 別名]
# 或者: from datalad.support.gitrepo.GitRepo import update_remote [as 別名]
def test_GitRepo_remote_update(path1, path2, path3):
git1 = GitRepo(path1)
git2 = GitRepo(path2)
git3 = GitRepo(path3)
git1.add_remote('git2', path2)
git1.add_remote('git3', path3)
# Setting up remote 'git2'
with open(op.join(path2, 'masterfile'), 'w') as f:
f.write("git2 in master")
git2.add('masterfile')
git2.commit("Add something to master.")
git2.checkout('branch2', ['-b'])
with open(op.join(path2, 'branch2file'), 'w') as f:
f.write("git2 in branch2")
git2.add('branch2file')
git2.commit("Add something to branch2.")
# Setting up remote 'git3'
with open(op.join(path3, 'masterfile'), 'w') as f:
f.write("git3 in master")
git3.add('masterfile')
git3.commit("Add something to master.")
git3.checkout('branch3', ['-b'])
with open(op.join(path3, 'branch3file'), 'w') as f:
f.write("git3 in branch3")
git3.add('branch3file')
git3.commit("Add something to branch3.")
git1.update_remote()
# checkouts are 'tests' themselves, since they'll raise CommandError
# if something went wrong
git1.checkout('branch2')
git1.checkout('branch3')
branches1 = git1.get_branches()
eq_({'branch2', 'branch3'}, set(branches1))