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


Python Repository.update方法代码示例

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


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

示例1: test_merge_isuptodate

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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_get_branch

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
 def test_get_branch(self):
     repo = Repository(self.cloned_from_repo)
     branch = repo.get_branch('newbranch')
     self.assertEquals(branch.name, 'newbranch')
     repo.update('newbranch')
     branch = repo.get_branch()
     self.assertEquals(branch.name, 'newbranch')
     with self.assertRaises(RepositoryError):
         branch = repo.get_branch('does_not_exist')
开发者ID:angelnan,项目名称:python-repoman,代码行数:11,代码来源:test_gitrepository.py

示例3: test_update_failures

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
    def test_update_failures(self):
        repo_name = 'fixture-3'
        self.add_content_to_repo(
            os.path.join(FIXTURE_PATH, 'fixture-3.git.bundle'),
            os.path.join(self.environment_path, repo_name))
        gitrepo = Repository(os.path.join(self.environment_path, repo_name))

        with self.assertRaises(RepositoryError):
            gitrepo.update("doesntexist")
开发者ID:angelnan,项目名称:python-repoman,代码行数:11,代码来源:test_gitrepository.py

示例4: test_is_merge

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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

示例5: test_is_merge

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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

示例6: test_no_notes_go_fine

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
    def test_no_notes_go_fine(self):
        gitrepo = Repository(self.cloned_from_repo)
        gitrepo.update('master')
        changeset = gitrepo.commit('A new commit!', allow_empty=True)

        notes = gitrepo.get_changeset_notes(changeset.hash)
        self.assertEqual([], notes)

        notes = gitrepo.get_changeset_notes()
        self.assertEqual([], notes)
开发者ID:mrodm,项目名称:python-repoman,代码行数:12,代码来源:test_gitrepository.py

示例7: test_merge_no_conflicts

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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

示例8: test_commit_custom_parent

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
 def test_commit_custom_parent(self):
     gitrepo = Repository(self.main_repo)
     gitrepo.update('master')
     c1 = gitrepo.commit('A commit', allow_empty=True)
     c2 = gitrepo.commit('Other commit', allow_empty=True)
     gitrepo.commit('Commit with custom parent', allow_empty=True,
         custom_parent=c1.hash)
     self.assertEquals(
         [p.hash for p in gitrepo.parents()],
         [c2.hash, c1.hash])
开发者ID:mrodm,项目名称:python-repoman,代码行数:12,代码来源:test_gitrepository.py

示例9: test_merge_no_conflicts

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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

示例10: test_commit_commits_but_with_removed_files

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
    def test_commit_commits_but_with_removed_files(self):
        file_name = "test1.txt"
        file_path = os.path.join(self.main_repo, file_name)
        commit_msg = "Test message"

        gitrepo = Repository(self.main_repo)
        gitrepo.update('master')
        os.remove(file_path)
        git = GitCmd(self.main_repo)

        gitrepo.commit(commit_msg)
        git('reset', hard=True)

        self.assertTrue(os.path.exists(file_path))
开发者ID:mrodm,项目名称:python-repoman,代码行数:16,代码来源:test_gitrepository.py

示例11: test_update

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
    def test_update(self):
        repo_name = 'fixture-3'
        path = os.path.join(self.environment_path, repo_name)
        self.add_content_to_repo(
            os.path.join(FIXTURE_PATH, 'fixture-3.git.bundle'),
            path)
        git = GitCmd(path)
        gitrepo = Repository(path)

        gitrepo.update("master")
        self.assertFalse(os.path.isfile(os.path.join(path, 'file2.txt')))
        self.assertTrue(os.path.isfile(os.path.join(path, 'file1.txt')))
        self.assertFalse(os.path.isfile(os.path.join(path, 'file3.txt')))
        self.assertNotEquals(git('rev-parse', '--abbrev-ref', 'HEAD'), 'HEAD')

        gitrepo.update("branch-1")
        self.assertTrue(os.path.isfile(os.path.join(path, 'file2.txt')))
        self.assertTrue(os.path.isfile(os.path.join(path, 'file1.txt')))
        self.assertFalse(os.path.isfile(os.path.join(path, 'file3.txt')))
        self.assertNotEquals(git('rev-parse', '--abbrev-ref', 'HEAD'), 'HEAD')

        gitrepo.update("branch-2")
        self.assertTrue(os.path.isfile(os.path.join(path, 'file3.txt')))
        self.assertFalse(os.path.isfile(os.path.join(path, 'file2.txt')))
        self.assertTrue(os.path.isfile(os.path.join(path, 'file1.txt')))
        self.assertNotEquals(git('rev-parse', '--abbrev-ref', 'HEAD'), 'HEAD')

        gitrepo.update("08b952ae66e59b216b1171c0c57082353bc80863")
        self.assertFalse(os.path.isfile(os.path.join(path, 'file3.txt')))
        self.assertFalse(os.path.isfile(os.path.join(path, 'file2.txt')))
        self.assertTrue(os.path.isfile(os.path.join(path, 'file1.txt')))
        self.assertEquals(git('rev-parse', '--abbrev-ref', 'HEAD'), 'HEAD')
开发者ID:mrodm,项目名称:python-repoman,代码行数:34,代码来源:test_gitrepository.py

示例12: test_append_get_and_has_notes

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
    def test_append_get_and_has_notes(self):
        gitrepo = Repository(self.cloned_from_repo)
        gitrepo.update('master')
        changeset = gitrepo.commit('A new commit!', allow_empty=True)

        gitrepo.append_note('Hello note 1', revision=changeset.hash)
        gitrepo.append_note('Goodbye note 2')

        notes = gitrepo.get_changeset_notes(changeset.hash)
        self.assertEqual(['Hello note 1', 'Goodbye note 2'], notes)

        self.assertTrue(gitrepo.has_note('Hello note 1'))
        self.assertTrue(gitrepo.has_note('Goodbye note 2', changeset.hash))
        self.assertFalse(gitrepo.has_note(''))
        self.assertFalse(gitrepo.has_note('\n'))
开发者ID:mrodm,项目名称:python-repoman,代码行数:17,代码来源:test_gitrepository.py

示例13: test_commit_commits_but_with_removed_files

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [as 别名]
    def test_commit_commits_but_with_removed_files(self):
        file_name = "test1.txt"
        file_path = os.path.join(self.main_repo, file_name)
        commit_msg = "Test message"

        gitrepo = Repository(self.main_repo)
        gitrepo.update('master')
        os.remove(file_path)
        gitrepo.commit(commit_msg)

        repo = pygit2.Repository(self.main_repo)
        repo.reset(repo.head.target.hex, pygit2.GIT_RESET_HARD)
        repo.checkout_head(strategy=(pygit2.GIT_CHECKOUT_FORCE |
                                     pygit2.GIT_CHECKOUT_REMOVE_UNTRACKED))

        self.assertTrue(os.path.exists(file_path))
开发者ID:angelnan,项目名称:python-repoman,代码行数:18,代码来源:test_gitrepository.py

示例14: test_merge_with_conflict

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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

示例15: test_merge_fastforward_no_ff

# 需要导入模块: from repoman.git.repository import Repository [as 别名]
# 或者: from repoman.git.repository.Repository import update [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


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