• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python hg.clone函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.hg.clone函数的典型用法代码示例。如果您正苦于以下问题:Python clone函数的具体用法?Python clone怎么用?Python clone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: testCloneWithBundleMissingRevs

    def testCloneWithBundleMissingRevs(self):
        # First create the bundle
        bundle = os.path.join(self.tmpdir, 'bundle')
        run_cmd(['hg', 'bundle', '-a', bundle], cwd=self.repodir)

        # Create a commit
        open(os.path.join(self.repodir, 'test.txt'), 'w').write('hello!')
        run_cmd(['hg', 'add', 'test.txt'], cwd=self.repodir)
        run_cmd(['hg', 'commit', '-m', 'adding changeset'], cwd=self.repodir)

        # Wrap unbundle so we can tell if it got called
        orig_unbundle = unbundle
        try:
            called = []

            def new_unbundle(*args, **kwargs):
                called.append(True)
                return orig_unbundle(*args, **kwargs)
            hg.unbundle = new_unbundle

            # Now clone it using the bundle
            clone(self.repodir, self.wc, bundles=[bundle])
            self.assertEquals(
                getRevisions(self.repodir), getRevisions(self.wc))
            self.assertEquals(called, [True])
        finally:
            hg.unbundle = orig_unbundle
开发者ID:bdacode,项目名称:build-tools,代码行数:27,代码来源:test_util_hg.py


示例2: testPushWithForce

 def testPushWithForce(self):
     clone(self.repodir, self.wc, revision=self.revisions[0],
           clone_by_rev=True)
     run_cmd(['touch', 'newfile'], cwd=self.wc)
     run_cmd(['hg', 'add', 'newfile'], cwd=self.wc)
     run_cmd(['hg', 'commit', '-m', '"re-add newfile"'], cwd=self.wc)
     push(self.repodir, self.wc, push_new_branches=False, force=True)
开发者ID:bdacode,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例3: testCloneWithBundleMissingRevs

    def testCloneWithBundleMissingRevs(self):
        # First create the bundle
        bundle = os.path.join(self.tmpdir, "bundle")
        run_cmd(["hg", "bundle", "-a", bundle], cwd=self.repodir)

        # Create a commit
        open(os.path.join(self.repodir, "test.txt"), "w").write("hello!")
        run_cmd(["hg", "add", "test.txt"], cwd=self.repodir)
        run_cmd(["hg", "commit", "-m", "adding changeset"], cwd=self.repodir)

        # Wrap unbundle so we can tell if it got called
        orig_unbundle = unbundle
        try:
            called = []

            def new_unbundle(*args, **kwargs):
                called.append(True)
                return orig_unbundle(*args, **kwargs)

            hg.unbundle = new_unbundle

            # Now clone it using the bundle
            clone(self.repodir, self.wc, bundles=[bundle])
            self.assertEquals(getRevisions(self.repodir), getRevisions(self.wc))
            self.assertEquals(called, [True])
        finally:
            hg.unbundle = orig_unbundle
开发者ID:B-Rich,项目名称:build-tools,代码行数:27,代码来源:test_util_hg.py


示例4: testPushForceFail

 def testPushForceFail(self):
     clone(self.repodir, self.wc, revision=self.revisions[0], clone_by_rev=True)
     run_cmd(['touch', 'newfile'], cwd=self.wc)
     run_cmd(['hg', 'add', 'newfile'], cwd=self.wc)
     run_cmd(['hg', 'commit', '-m', '"add newfile"'], cwd=self.wc)
     self.assertRaises(Exception, push, self.repodir, self.wc,
             push_new_branches=False, force=False)
开发者ID:EkkiD,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例5: testShareExtraFiles

    def testShareExtraFiles(self):
        shareBase = os.path.join(self.tmpdir, 'share')
        backup = os.path.join(self.tmpdir, 'backup')

        # Clone the original repo
        mercurial(self.repodir, self.wc, shareBase=shareBase)

        clone(self.repodir, backup)

        # Make the working repo have a new file. We need it to have an earlier
        # timestamp to trigger the odd behavior in hg, so use '-d yesterday'
        run_cmd(['touch', '-d', 'yesterday', 'newfile'], cwd=self.wc)
        run_cmd(['hg', 'add', 'newfile'], cwd=self.wc)
        run_cmd(['hg', 'commit', '-m', '"add newfile"'], cwd=self.wc)

        # Reset the share base to remove the 'add newfile' commit. We
        # overwrite repodir with the backup that doesn't have the commit,
        # then clone the repodir to a throwaway dir to create the new
        # shareBase. Now self.wc still points to shareBase, but the
        # changeset that self.wc was on is lost.
        shutil.rmtree(self.repodir)
        shutil.rmtree(shareBase)
        clone(backup, self.repodir)
        throwaway = os.path.join(self.tmpdir, 'throwaway')
        mercurial(self.repodir, throwaway, shareBase=shareBase)

        # Try and update our working copy
        mercurial(self.repodir, self.wc, shareBase=shareBase)

        self.assertFalse(os.path.exists(os.path.join(self.wc, 'newfile')))
开发者ID:bdacode,项目名称:build-tools,代码行数:30,代码来源:test_util_hg.py


示例6: testPurgeUntrackedFile

 def testPurgeUntrackedFile(self):
     clone(self.repodir, self.wc)
     fileToPurge = os.path.join(self.wc, "fileToPurge")
     with file(fileToPurge, "a") as f:
         f.write("purgeme")
     purge(self.wc)
     self.assertFalse(os.path.exists(fileToPurge))
开发者ID:B-Rich,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例7: testApplyAndPushFail

 def testApplyAndPushFail(self):
     clone(self.repodir, self.wc)
     def c(repo, attempt, remote):
         run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo)
         run_cmd(['hg', 'tag', '-f', 'CONFLICTING_TAG'], cwd=remote)
     self.assertRaises(HgUtilError, apply_and_push, self.wc, self.repodir,
                       lambda r, a: c(r, a, self.repodir), max_attempts=2)
开发者ID:EkkiD,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例8: testCloneBranch

 def testCloneBranch(self):
     clone(self.repodir, self.wc, branch="branch2", update_dest=False, clone_by_rev=True)
     # On hg 1.6, we should only have a subset of the revisions
     if hg_ver() >= (1, 6, 0):
         self.assertEquals(self.revisions[1:], getRevisions(self.wc))
     else:
         self.assertEquals(self.revisions, getRevisions(self.wc))
开发者ID:B-Rich,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例9: testCloneRevision

 def testCloneRevision(self):
     clone(self.repodir, self.wc,
           revision=self.revisions[0], update_dest=False,
           clone_by_rev=True)
     # We'll only get a subset of the revisions
     self.assertEquals(self.revisions[:1] + self.revisions[2:],
                       getRevisions(self.wc))
开发者ID:bdacode,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例10: testOutofSyncMirrorFailingMaster

    def testOutofSyncMirrorFailingMaster(self):
        # First create the mirror
        mirror = os.path.join(self.tmpdir, "repo2")
        clone(self.repodir, mirror)

        shareBase = os.path.join(self.tmpdir, "share")
        os.mkdir(shareBase)
        mercurial(self.repodir, self.wc, shareBase=shareBase, mirrors=[mirror])

        # Create a bundle
        bundle = os.path.join(self.tmpdir, "bundle")
        run_cmd(["hg", "bundle", "-a", bundle], cwd=self.repodir)

        # Move our repodir out of the way so that pulling/cloning from it fails
        os.rename(self.repodir, self.repodir + "-bad")

        # Try and update to a non-existent revision using our mirror and
        # bundle, with the master failing. We should fail
        self.assertRaises(
            subprocess.CalledProcessError,
            mercurial,
            self.repodir,
            self.wc,
            shareBase=shareBase,
            mirrors=[mirror],
            bundles=[bundle],
            revision="1234567890",
        )
开发者ID:B-Rich,项目名称:build-tools,代码行数:28,代码来源:test_util_hg.py


示例11: testApplyAndPush

    def testApplyAndPush(self):
        clone(self.repodir, self.wc)

        def c(repo, attempt):
            run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo)
        apply_and_push(self.wc, self.repodir, c)
        self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
开发者ID:bdacode,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例12: testApplyAndPushWithNoChange

    def testApplyAndPushWithNoChange(self):
        clone(self.repodir, self.wc)

        def c(r, a):
            pass
        self.assertRaises(
            HgUtilError, apply_and_push, self.wc, self.repodir, c)
开发者ID:bdacode,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例13: testPullDefault

    def testPullDefault(self):
        clone(self.repodir, self.wc)
        run_cmd(['hg', 'tag', '-f', 'TAG1'], cwd=self.repodir)
        revisions = getRevisions(self.repodir)

        rev = pull(self.repodir, self.wc, revision='default')
        self.assertEquals(rev, revisions[0])
        self.assertEquals(getRevisions(self.wc), revisions)
开发者ID:bdacode,项目名称:build-tools,代码行数:8,代码来源:test_util_hg.py


示例14: testPurgeTrackedFile

 def testPurgeTrackedFile(self):
     clone(self.repodir, self.wc)
     fileToModify = os.path.join(self.wc, "hello.txt")
     with open(fileToModify, "w") as f:
         f.write("hello!")
     purge(self.wc)
     with open(fileToModify, "r") as f:
         content = f.read()
     self.assertEqual(content, "hello!")
开发者ID:B-Rich,项目名称:build-tools,代码行数:9,代码来源:test_util_hg.py


示例15: testPull

    def testPull(self):
        # Clone just the first rev
        clone(self.repodir, self.wc, revision=self.revisions[-1], update_dest=False, clone_by_rev=True)
        self.assertEquals(getRevisions(self.wc), self.revisions[-1:])

        # Now pull in new changes
        rev = pull(self.repodir, self.wc, update_dest=False)
        self.assertEquals(rev, None)
        self.assertEquals(getRevisions(self.wc), self.revisions)
开发者ID:B-Rich,项目名称:build-tools,代码行数:9,代码来源:test_util_hg.py


示例16: testApplyAndPushRebaseFails

 def testApplyAndPushRebaseFails(self):
     clone(self.repodir, self.wc)
     def c(repo, attempt, remote):
         run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo)
         if attempt in (1,2):
             run_cmd(['hg', 'tag', '-f', 'CONFLICTING_TAG'], cwd=remote)
     apply_and_push(self.wc, self.repodir,
                    lambda r, a: c(r, a, self.repodir), max_attempts=3)
     self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
开发者ID:EkkiD,项目名称:build-tools,代码行数:9,代码来源:test_util_hg.py


示例17: testCloneWithBadMirror

    def testCloneWithBadMirror(self):
        mirror = os.path.join(self.tmpdir, 'repo2')

        # Now clone from the mirror
        clone(self.repodir, self.wc, mirrors=[mirror])

        # We still end up with a valid repo
        self.assertEquals(self.revisions, getRevisions(self.wc))
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:bdacode,项目名称:build-tools,代码行数:9,代码来源:test_util_hg.py


示例18: testApplyAndPushFail

    def testApplyAndPushFail(self):
        clone(self.repodir, self.wc)

        def c(repo, attempt, remote):
            run_cmd(["hg", "tag", "-f", "TEST"], cwd=repo)
            run_cmd(["hg", "tag", "-f", "CONFLICTING_TAG"], cwd=remote)

        self.assertRaises(
            HgUtilError, apply_and_push, self.wc, self.repodir, lambda r, a: c(r, a, self.repodir), max_attempts=2
        )
开发者ID:B-Rich,项目名称:build-tools,代码行数:10,代码来源:test_util_hg.py


示例19: testApplyAndPushWithRebase

 def testApplyAndPushWithRebase(self):
     clone(self.repodir, self.wc)
     def c(repo, attempt, remote):
         run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo)
         if attempt == 1:
             run_cmd(['hg', 'rm', 'hello.txt'], cwd=remote)
             run_cmd(['hg', 'commit', '-m', 'test'], cwd=remote)
     apply_and_push(self.wc, self.repodir,
                    lambda r, a: c(r, a, self.repodir), max_attempts=2)
     self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
开发者ID:EkkiD,项目名称:build-tools,代码行数:10,代码来源:test_util_hg.py


示例20: testPurgeVeryLongPath

 def testPurgeVeryLongPath(self):
     clone(self.repodir, self.wc)
     # now create a very long path name
     longPath = self.wc
     for new_dir in xrange(1, 64):
         longPath = os.path.join(longPath, str(new_dir))
     os.makedirs(longPath)
     self.assertTrue(os.path.isdir(longPath))
     purge(self.wc)
     self.assertFalse(os.path.isdir(longPath))
开发者ID:bdacode,项目名称:build-tools,代码行数:10,代码来源:test_util_hg.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python hg.is_hg_cset函数代码示例发布时间:2022-05-26
下一篇:
Python hg.apply_and_push函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap