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

Python hg.path函数代码示例

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

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



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

示例1: testBustedHgrc

    def testBustedHgrc(self):
        # Test that we can recover from hgrc being lost
        mercurial(self.repodir, self.wc)

        # Delete .hg/hgrc
        os.unlink(os.path.join(self.wc, '.hg', 'hgrc'))

        # path is busted now
        p = path(self.wc)
        self.assertEquals(p, None)

        # cloning again should fix this up
        mercurial(self.repodir, self.wc)

        p = path(self.wc)
        self.assertEquals(p, self.repodir)
开发者ID:bdacode,项目名称:build-tools,代码行数:16,代码来源:test_util_hg.py


示例2: 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


示例3: testAdjustPaths

    def testAdjustPaths(self):
        mercurial(self.repodir, self.wc)

        # Make sure our default path is correct
        self.assertEquals(path(self.wc), self.repodir)

        # Add a comment, make sure it's still there if we don't change
        # anything
        hgrc = os.path.join(self.wc, '.hg', 'hgrc')
        open(hgrc, 'a').write("# Hello world")
        adjust_paths(self.wc, default=self.repodir)
        self.assert_("Hello world" in open(hgrc).read())

        # Add a path, and the comment goes away
        adjust_paths(self.wc, test=self.repodir)
        self.assert_("Hello world" not in open(hgrc).read())

        # Make sure our paths are correct
        self.assertEquals(path(self.wc), self.repodir)
        self.assertEquals(path(self.wc, 'test'), self.repodir)
开发者ID:bdacode,项目名称:build-tools,代码行数:20,代码来源:test_util_hg.py


示例4: testBustedHgrcWithShare

    def testBustedHgrcWithShare(self):
        # Test that we can recover from hgrc being lost
        shareBase = os.path.join(self.tmpdir, 'share')
        sharerepo = os.path.join(shareBase, self.repodir.lstrip("/"))
        os.mkdir(shareBase)
        mercurial(self.repodir, self.wc, shareBase=shareBase)

        # Delete .hg/hgrc
        for d in sharerepo, self.wc:
            f = os.path.join(d, '.hg', 'hgrc')
            os.unlink(f)

        # path is busted now
        p = path(self.wc)
        self.assertEquals(p, None)

        # cloning again should fix this up
        mercurial(self.repodir, self.wc, shareBase=shareBase)

        p = path(self.wc)
        self.assertEquals(p, self.repodir)
开发者ID:bdacode,项目名称:build-tools,代码行数:21,代码来源:test_util_hg.py


示例5: testPullWithBadMirror

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

        # Now clone from the original
        clone(self.repodir, self.wc)

        # Create a new commit in the original repo
        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)

        # Pull using the mirror
        pull(self.repodir, self.wc, mirrors=[mirror])

        self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))

        # Our default path should point to the original repo
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:bdacode,项目名称:build-tools,代码行数:18,代码来源:test_util_hg.py


示例6: testCloneWithMirror

    def testCloneWithMirror(self):
        mirror = os.path.join(self.tmpdir, 'repo2')
        clone(self.repodir, mirror)

        # Create a commit in the original repo
        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)

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

        # We'll be missing the new revision from repodir
        self.assertNotEquals(getRevisions(self.repodir), getRevisions(self.wc))
        # But we should have everything from the mirror
        self.assertEquals(getRevisions(mirror), getRevisions(self.wc))
        # Our default path should point to the original repo though.
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:bdacode,项目名称:build-tools,代码行数:18,代码来源:test_util_hg.py


示例7: testCloneWithRevAndMirror

    def testCloneWithRevAndMirror(self):
        mirror = os.path.join(self.tmpdir, "repo2")
        clone(self.repodir, mirror)

        # Create a commit in the original repo
        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)

        # Now clone from the mirror
        revisions = getRevisions(self.repodir)
        clone(self.repodir, self.wc, revision=revisions[0], mirrors=[mirror], clone_by_rev=True)

        # We'll be missing the middle revision (on another branch)
        self.assertEquals(revisions[:2] + revisions[3:], getRevisions(self.wc))
        # But not from the mirror
        self.assertNotEquals(getRevisions(mirror), getRevisions(self.wc))
        # Our default path should point to the original repo though.
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:B-Rich,项目名称:build-tools,代码行数:19,代码来源:test_util_hg.py


示例8: testCloneWithRevAndMirror

    def testCloneWithRevAndMirror(self):
        mirror = os.path.join(self.tmpdir, 'repo2')
        clone(self.repodir, mirror)

        # Create a commit in the original repo
        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)

        # Now clone from the mirror
        revisions = getRevisions(self.repodir)
        clone(self.repodir, self.wc, revision=revisions[0],
              mirrors=[mirror], clone_by_rev=True)

        # We'll be missing the middle revision (on another branch)
        self.assertEquals(revisions[:2] + revisions[3:], getRevisions(self.wc))
        # But not from the mirror
        self.assertNotEquals(getRevisions(mirror), getRevisions(self.wc))
        # Our default path should point to the original repo though.
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:bdacode,项目名称:build-tools,代码行数:20,代码来源:test_util_hg.py


示例9: testPullWithUnrelatedMirror

    def testPullWithUnrelatedMirror(self):
        mirror = os.path.join(self.tmpdir, "repo2")
        run_cmd(["%s/init_hgrepo.sh" % os.path.dirname(__file__), mirror])

        # Now clone from the original
        clone(self.repodir, self.wc)

        # Create a new commit in the original repo
        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)

        # Pull using the mirror
        pull(self.repodir, self.wc, mirrors=[mirror])

        self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
        # We shouldn't have anything from the unrelated mirror
        self.assertEquals(set(), set(getRevisions(mirror)).intersection(set(getRevisions(self.wc))))

        # Our default path should point to the original repo
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:B-Rich,项目名称:build-tools,代码行数:21,代码来源:test_util_hg.py


示例10: testCloneWithBundle

    def testCloneWithBundle(self):
        # First create the bundle
        bundle = os.path.join(self.tmpdir, 'bundle')
        run_cmd(['hg', 'bundle', '-a', bundle], 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(self.revisions, getRevisions(self.wc))
            self.assertEquals(called, [True])
            self.assertEquals(path(self.wc), self.repodir)
        finally:
            hg.unbundle = orig_unbundle
开发者ID:EkkiD,项目名称:build-tools,代码行数:21,代码来源:test_util_hg.py


示例11: testPullWithUnrelatedMirror

    def testPullWithUnrelatedMirror(self):
        mirror = os.path.join(self.tmpdir, 'repo2')
        run_cmd(['%s/init_hgrepo.sh' % os.path.dirname(__file__), mirror])

        # Now clone from the original
        clone(self.repodir, self.wc)

        # Create a new commit in the original repo
        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)

        # Pull using the mirror
        pull(self.repodir, self.wc, mirrors=[mirror])

        self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
        # We shouldn't have anything from the unrelated mirror
        self.assertEquals(set(),
                          set(getRevisions(mirror)).intersection(set(getRevisions(self.wc))))

        # Our default path should point to the original repo
        self.assertEquals(self.repodir, path(self.wc))
开发者ID:bdacode,项目名称:build-tools,代码行数:22,代码来源:test_util_hg.py


示例12: testPath

 def testPath(self):
     clone(self.repodir, self.wc)
     p = path(self.wc)
     self.assertEquals(p, self.repodir)
开发者ID:bdacode,项目名称:build-tools,代码行数:4,代码来源:test_util_hg.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python hg.pull函数代码示例发布时间:2022-05-26
下一篇:
Python hg.mercurial函数代码示例发布时间: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