本文整理汇总了Python中repoman.git.repository.Repository.push方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.push方法的具体用法?Python Repository.push怎么用?Python Repository.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repoman.git.repository.Repository
的用法示例。
在下文中一共展示了Repository.push方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_push
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import push [as 别名]
def test_push(self):
gitrepo1 = pygit2.Repository(self.main_repo_bare)
gitrepo2 = pygit2.Repository(self.cloned_from_repo)
print "Main repo %s " % gitrepo1.path
print "Cloned from repo %s " % gitrepo2.path
walk_topological = lambda repo: repo.walk(
repo.head.target, pygit2.GIT_SORT_TOPOLOGICAL)
changesets1 = list(walk_topological(gitrepo1))
changesets2 = list(walk_topological(gitrepo2))
self.assertNotEqual(len(changesets1), len(changesets2))
repo2 = Repository(self.cloned_from_repo)
with self.assertRaises(RepositoryError):
repo2.push(
self.main_repo_bare,
"inexistent_destination",
ref_name='master')
repo2.push(self.main_repo, self.main_repo_bare, ref_name='master')
changesets1 = list(walk_topological(gitrepo1))
changesets2 = list(walk_topological(gitrepo2))
self.assertEquals(len(changesets1), len(changesets2))
示例2: test_push_to_unqualified_destination
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import push [as 别名]
def test_push_to_unqualified_destination(self):
git1 = GitCmd(self.main_repo_bare)
git2 = GitCmd(self.cloned_from_repo)
repo2 = Repository(self.cloned_from_repo)
cs = repo2.commit('A commit', allow_empty=True)
# Pushing a revision to a reference name that doesn't exist is
# considered a push to an unqualified destination
repo2.push(self.main_repo, self.main_repo_bare, rev=cs.hash, ref_name='unqualified')
changesets1 = list(git1('log', 'unqualified', pretty='oneline', _iter=True))
changesets2 = list(git2('log', cs.hash, pretty='oneline', _iter=True))
self.assertEquals(changesets1, changesets2)
示例3: test_push_only_notes
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import push [as 别名]
def test_push_only_notes(self):
git1 = GitCmd(self.main_repo_bare)
git2 = GitCmd(self.cloned_from_repo)
repo2 = Repository(self.cloned_from_repo)
cs = repo2.commit('A commit', allow_empty=True)
repo2.push(self.main_repo, self.main_repo_bare, rev=cs.hash, ref_name='master')
notes_ref = repo2.append_note('some note dude', cs.hash)
repo2.push(self.main_repo, self.main_repo_bare, ref_name='refs/notes/*')
notes_ref_repo1, commit_ref_repo1 = git1('notes', 'list').split()
notes_ref_repo2, commit_ref_repo2 = git2('notes', 'list').split()
self.assertEqual(commit_ref_repo1, commit_ref_repo2)
self.assertEqual(notes_ref_repo1, notes_ref_repo2)
self.assertEqual(notes_ref, notes_ref_repo1)
示例4: test_exterminate_branch
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import push [as 别名]
def test_exterminate_branch(self):
branch_name = 'newbranch'
gitrepo = Repository(self.cloned_from_repo)
gitrepo_main = Repository(self.main_repo)
gitrepo.update(branch_name)
# Pushing the branch to the remote repo so we can check it's removed
# remotely too
gitrepo.push(None, self.main_repo, ref_name=branch_name)
self.assertEquals(len(list(gitrepo.get_branches())), 2)
self.assertEquals(len(list(gitrepo_main.get_branches())), 2)
gitrepo.exterminate_branch(branch_name, None, self.main_repo)
self.assertEquals(len(list(gitrepo.get_branches())), 1)
self.assertEquals(len(list(gitrepo_main.get_branches())), 1)
# Terminating a branch already terminated
# it shouldn't do anything but warning with a message
gitrepo.exterminate_branch(branch_name, None, self.main_repo)
示例5: test_push
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import push [as 别名]
def test_push(self):
git1 = GitCmd(self.main_repo_bare)
git2 = GitCmd(self.cloned_from_repo)
changesets1 = list(git1('log', pretty='oneline', _iter=True))
changesets2 = list(git2('log', pretty='oneline', _iter=True))
self.assertNotEqual(len(changesets1), len(changesets2))
repo2 = Repository(self.cloned_from_repo)
with self.assertRaises(RepositoryError):
repo2.push(
self.main_repo_bare,
"inexistent_destination",
ref_name='master')
repo2.push(self.main_repo, self.main_repo_bare, ref_name='master')
changesets1 = list(git1('log', pretty='oneline', _iter=True))
changesets2 = list(git2('log', pretty='oneline', _iter=True))
self.assertEquals(len(changesets1), len(changesets2))
示例6: test_push_all_with_reference_and_revision
# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import push [as 别名]
def test_push_all_with_reference_and_revision(self):
git1 = GitCmd(self.main_repo_bare)
git2 = GitCmd(self.cloned_from_repo)
repo2 = Repository(self.cloned_from_repo)
repo2.commit('A commit', allow_empty=True)
cs = repo2.commit('A second commit', allow_empty=True)
repo2.tag('unqualified', revision=cs.hash)
notes_ref = repo2.append_note('some note dude', cs.hash)
repo2.push(self.main_repo, self.main_repo_bare, rev=cs.hash, ref_name='master')
notes_ref_repo1, commit_ref_repo1 = git1('notes', 'list').split()
notes_ref_repo2, commit_ref_repo2 = git2('notes', 'list').split()
self.assertEqual(commit_ref_repo1, commit_ref_repo2)
self.assertEqual(notes_ref_repo1, notes_ref_repo2)
self.assertEqual(notes_ref, notes_ref_repo1)
changesets1 = list(git1('log', 'unqualified', '--', pretty='oneline', _iter=True))
changesets2 = list(git2('log', 'unqualified', '--', pretty='oneline', _iter=True))
self.assertEquals(changesets1, changesets2)