本文整理汇总了Python中repoman.git.repository.Repository.pull方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.pull方法的具体用法?Python Repository.pull怎么用?Python Repository.pull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repoman.git.repository.Repository
的用法示例。
在下文中一共展示了Repository.pull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pull
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import pull [as 别名]
def test_pull(self):
gitrepo1 = GitCmd(self.main_repo)
gitrepo2 = GitCmd(self.cloned_from_repo)
self.assertNotEqual(
gitrepo1('rev-list', all=True).split(),
gitrepo2('rev-list', all=True).split())
repo = Repository(self.main_repo)
# Pulling a branch
self.assertNotIn('newbranch', [b.name for b in repo.get_branches()])
repo.pull(remote=self.cloned_from_repo, branch='newbranch')
self.assertIn('newbranch', [b.name for b in repo.get_branches()])
# Pulling everything
repo.pull(remote=self.cloned_from_repo)
self.assertEqual(
gitrepo1('rev-list', all=True).split().sort(),
gitrepo2('rev-list', all=True).split().sort())
gitrepo1_refs = list(gitrepo1('show-ref', _iter=True))
gitrepo2_refs = list(gitrepo2('show-ref', _iter=True))
# Check that all remote refs have been fetched
for ref in gitrepo2_refs:
self.assertIn(ref, gitrepo1_refs)
# Pulling from a non existing remote
with self.assertRaises(RepositoryError):
repo.pull(remote='wrong repo')
示例2: test_pull
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import pull [as 别名]
def test_pull(self):
gitrepo1 = pygit2.Repository(self.main_repo)
gitrepo2 = pygit2.Repository(self.cloned_from_repo)
self.assertNotEqual(
len(list(gitrepo1.walk(gitrepo1.head.target,
pygit2.GIT_SORT_TOPOLOGICAL))),
len(list(gitrepo2.walk(gitrepo2.head.target,
pygit2.GIT_SORT_TOPOLOGICAL))))
repo = Repository(self.main_repo)
repo.pull(remote=self.cloned_from_repo)
self.assertEqual(
len(list(gitrepo1.walk(gitrepo1.head.target,
pygit2.GIT_SORT_TOPOLOGICAL))),
len(list(gitrepo2.walk(gitrepo2.head.target,
pygit2.GIT_SORT_TOPOLOGICAL))))
with self.assertRaises(RepositoryError):
repo.pull(remote='wrong repo')