当前位置: 首页>>代码示例>>Python>>正文


Python Repository.merge方法代码示例

本文整理汇总了Python中repoman.git.repository.Repository.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.merge方法的具体用法?Python Repository.merge怎么用?Python Repository.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在repoman.git.repository.Repository的用法示例。


在下文中一共展示了Repository.merge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_merge_isuptodate

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
 def test_merge_isuptodate(self):
     gitrepo = Repository(self.cloned_from_repo)
     gitrepo.update('master')
     uptodate_hash = '52109e71fd7f16cb366acfcbb140d6d7f2fc50c9'
     cs = gitrepo[uptodate_hash]
     should_be_none = gitrepo.merge(other_rev=cs)
     self.assertIsNone(should_be_none)
开发者ID:angelnan,项目名称:python-repoman,代码行数:9,代码来源:test_gitrepository.py

示例2: test_is_merge

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
 def test_is_merge(self):
     git = GitCmd(self.cloned_from_repo)
     headnewbranch = git('show-ref', '-s', 'refs/heads/newbranch')
     gitrepo = Repository(self.cloned_from_repo)
     self.assertFalse(gitrepo.is_merge(git('rev-parse', 'HEAD')))
     # Do a merge
     gitrepo.update('master')
     merge_rev = gitrepo.merge(other_rev=gitrepo[headnewbranch])
     self.assertTrue(gitrepo.is_merge(merge_rev.hash))
开发者ID:mrodm,项目名称:python-repoman,代码行数:11,代码来源:test_gitrepository.py

示例3: test_is_merge

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
 def test_is_merge(self):
     repo = pygit2.Repository(self.cloned_from_repo)
     reference = repo.lookup_reference('refs/remotes/origin/newbranch')
     headnewbranch = reference.get_object().hex
     gitrepo = Repository(self.cloned_from_repo)
     self.assertFalse(gitrepo.is_merge(repo.head.get_object().hex))
     # Do a merge
     gitrepo.update('master')
     merge_rev = gitrepo.merge(other_rev=gitrepo[headnewbranch])
     self.assertTrue(gitrepo.is_merge(merge_rev.hash))
开发者ID:angelnan,项目名称:python-repoman,代码行数:12,代码来源:test_gitrepository.py

示例4: test_merge_with_conflict

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
    def test_merge_with_conflict(self):
        gitrepo = Repository(self.cloned_from_repo)
        # Checkout
        gitrepo.update('newbranch')
        file_to_conflict_name = 'test1.txt'
        file_to_conflict = os.path.join(self.cloned_from_repo,
                                        file_to_conflict_name)
        with open(file_to_conflict, "w") as file:
            file_content = "Absurd content"
            file.write(file_content)

        gitrepo.add(file_to_conflict_name)
        conflict_cs = gitrepo.commit("Provoking conflict")
        gitrepo.update('master')
        try:
            gitrepo.merge(other_rev=conflict_cs)
            self.fail()
        except MergeConflictError as exp:
            self.assertTrue('Conflicts found: merging test1.txt failed' in exp)
开发者ID:angelnan,项目名称:python-repoman,代码行数:21,代码来源:test_gitrepository.py

示例5: test_merge_no_conflicts

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
 def test_merge_no_conflicts(self):
     repo = pygit2.Repository(self.cloned_from_repo)
     headnewbranch = repo.lookup_reference(
         'refs/remotes/origin/newbranch').get_object().hex
     gitrepo = Repository(self.cloned_from_repo)
     # Checkout to master
     gitrepo.update('master')
     cs = gitrepo.merge(other_rev=gitrepo[headnewbranch])
     self.assertEquals(len(repo.head.get_object().parents), 2)
     self.assertEquals(repo.head.get_object().hex, cs.hash)
开发者ID:angelnan,项目名称:python-repoman,代码行数:12,代码来源:test_gitrepository.py

示例6: test_merge_no_conflicts

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
    def test_merge_no_conflicts(self):
        git = GitCmd(self.cloned_from_repo)

        headnewbranch = git('rev-parse', 'refs/heads/newbranch')
        gitrepo = Repository(self.cloned_from_repo)
        # Checkout to master
        gitrepo.update('master')
        cs = gitrepo.merge(other_rev=gitrepo[headnewbranch])
        self.assertEquals(len(git('log', '-1', pretty='%P').split()), 2)
        self.assertEquals(git('rev-parse', 'HEAD'), cs.hash)
开发者ID:mrodm,项目名称:python-repoman,代码行数:12,代码来源:test_gitrepository.py

示例7: test_merge_fastforward_no_ff

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
    def test_merge_fastforward_no_ff(self):
        repo = pygit2.Repository(self.cloned_from_repo)
        gitrepo = Repository(self.cloned_from_repo)
        gitrepo.update('master')
        gitrepo.branch('ff-branch')
        ff_file_name = 'ff-file.txt'
        ff_file = os.path.join(self.cloned_from_repo, ff_file_name)
        with open(ff_file, "w") as file:
            file_content = "Absurd content"
            file.write(file_content)
        gitrepo.add(ff_file_name)

        ff_head = gitrepo.commit(message="commit ff file")
        gitrepo.update('master')
        cs = gitrepo.merge(other_rev=ff_head, other_branch_name='test')
        self.assertEquals(len(repo.head.get_object().parents), 2)
        self.assertEquals(repo.head.get_object().hex, cs.hash)
        # We want a commit in fastforward merges, hashes must be different
        self.assertNotEquals(ff_head.hash, cs.hash)
        self.assertTrue(os.path.isfile(ff_file))
开发者ID:angelnan,项目名称:python-repoman,代码行数:22,代码来源:test_gitrepository.py

示例8: test_merge_fastforward_no_ff

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
    def test_merge_fastforward_no_ff(self):
        git = GitCmd(self.cloned_from_repo)
        gitrepo = Repository(self.cloned_from_repo)
        gitrepo.update('master')
        gitrepo.branch('ff-branch')
        ff_file_name = 'ff-file.txt'
        ff_file = os.path.join(self.cloned_from_repo, ff_file_name)
        with open(ff_file, "w") as file:
            file_content = "Absurd content"
            file.write(file_content)
        gitrepo.add(ff_file_name)

        ff_head = gitrepo.commit(message="commit ff file")
        gitrepo.update('master')
        cs = gitrepo.merge(other_rev=ff_head, other_branch_name='test')
        self.assertEquals(len(git('log', '-1', pretty='%P').split()), 2)
        self.assertEquals(git('rev-parse', 'HEAD'), cs.hash)
        # We want a commit in fastforward merges, hashes must be different
        self.assertNotEquals(ff_head.hash, cs.hash)
        self.assertTrue(os.path.isfile(ff_file))
开发者ID:mrodm,项目名称:python-repoman,代码行数:22,代码来源:test_gitrepository.py

示例9: test_merge_wrong_revision

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import merge [as 别名]
 def test_merge_wrong_revision(self):
     gitrepo = Repository(self.cloned_from_repo)
     with self.assertRaises(RepositoryError):
         gitrepo.merge("wrong revision")
开发者ID:angelnan,项目名称:python-repoman,代码行数:6,代码来源:test_gitrepository.py


注:本文中的repoman.git.repository.Repository.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。