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

Python hg.HgClient类代码示例

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

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



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

示例1: test_diff_relpath

    def test_diff_relpath(self):

        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEquals('diff --git local/added.txt local/added.txt\nnew file mode 100644\n--- /dev/null\n+++ local/added.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git local/deleted.txt local/deleted.txt\ndeleted file mode 100644\ndiff --git local/modified-fs.txt local/modified-fs.txt\n--- local/modified-fs.txt\n+++ local/modified-fs.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git local/modified.txt local/modified.txt\n--- local/modified.txt\n+++ local/modified.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file', client.get_diff(basepath=os.path.dirname(self.local_path)))
开发者ID:vcstools,项目名称:vcstools,代码行数:7,代码来源:test_hg.py


示例2: setUpClass

    def setUpClass(self):
        HGClientTestSetups.setUpClass()
        url = self.local_url
        client = HgClient(self.local_path)
        client.checkout(url)

        self.basepath_export = os.path.join(self.root_directory, 'export')
开发者ID:vcstools,项目名称:vcstools,代码行数:7,代码来源:test_hg.py


示例3: test_diff_relpath

    def test_diff_relpath(self):
        from vcstools.hg import HgClient
        client = HgClient(self.readonly_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEquals('diff --git readonly/added.txt readonly/added.txt\nnew file mode 100644\n--- /dev/null\n+++ readonly/added.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git readonly/deleted.txt readonly/deleted.txt\ndeleted file mode 100644\ndiff --git readonly/modified-fs.txt readonly/modified-fs.txt\n--- readonly/modified-fs.txt\n+++ readonly/modified-fs.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git readonly/modified.txt readonly/modified.txt\n--- readonly/modified.txt\n+++ readonly/modified.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\n\n', client.get_diff(basepath=os.path.dirname(self.readonly_path)))
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:7,代码来源:test_hg.py


示例4: test_export_repository

    def test_export_repository(self):
        client = HgClient(self.local_path)
        self.assertTrue(client.export_repository(self.local_version, self.basepath_export))

        self.assertTrue(os.path.exists(self.basepath_export + ".tar.gz"))
        self.assertFalse(os.path.exists(self.basepath_export + ".tar"))
        self.assertFalse(os.path.exists(self.basepath_export))
开发者ID:jbohren-forks,项目名称:vcstools,代码行数:7,代码来源:test_hg.py


示例5: test_status

 def test_status(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         "M modified-fs.txt\nM modified.txt\nA added.txt\nR deleted.txt\n! deleted-fs.txt\n", client.get_status()
     )
开发者ID:jbohren-forks,项目名称:vcstools,代码行数:7,代码来源:test_hg.py


示例6: test_get_environment_metadata

 def test_get_environment_metadata(self):
     # Verify that metadata is generated
     directory = tempfile.mkdtemp()
     self.directories['local'] = directory
     local_path = os.path.join(directory, "local")
     client = HgClient(local_path)
     self.assertTrue('version' in client.get_environment_metadata())
开发者ID:vcstools,项目名称:vcstools,代码行数:7,代码来源:test_hg.py


示例7: test_status_relpath

 def test_status_relpath(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         "M local/modified-fs.txt\nM local/modified.txt\nA local/added.txt\nR local/deleted.txt\n! local/deleted-fs.txt\n",
         client.get_status(basepath=os.path.dirname(self.local_path)),
     )
开发者ID:jbohren-forks,项目名称:vcstools,代码行数:8,代码来源:test_hg.py


示例8: test_get_log_defaults

 def test_get_log_defaults(self):
     client = HgClient(self.local_path)
     client.checkout(self.local_url)
     log = client.get_log()
     self.assertEquals(4, len(log))
     self.assertEquals('modified', log[0]['message'])
     for key in ['id', 'author', 'email', 'date', 'message']:
         self.assertTrue(log[0][key] is not None, key)
开发者ID:vcstools,项目名称:vcstools,代码行数:8,代码来源:test_hg.py


示例9: test_checkout_dir_exists

 def test_checkout_dir_exists(self):
     url = self.remote_path
     client = HgClient(self.local_path)
     self.assertFalse(client.path_exists())
     os.makedirs(self.local_path)
     self.assertTrue(client.checkout(url))
     # non-empty
     self.assertFalse(client.checkout(url))
开发者ID:vcstools,项目名称:vcstools,代码行数:8,代码来源:test_hg.py


示例10: test_diff

    def test_diff(self):

        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEquals(
            "diff --git ./added.txt ./added.txt\nnew file mode 100644\n--- /dev/null\n+++ ./added.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./deleted.txt ./deleted.txt\ndeleted file mode 100644\ndiff --git ./modified-fs.txt ./modified-fs.txt\n--- ./modified-fs.txt\n+++ ./modified-fs.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./modified.txt ./modified.txt\n--- ./modified.txt\n+++ ./modified.txt\[email protected]@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file",
            client.get_diff(),
        )
开发者ID:jbohren-forks,项目名称:vcstools,代码行数:9,代码来源:test_hg.py


示例11: test_get_current_version_label

 def test_get_current_version_label(self):
     url = self.local_url
     version = self.local_version
     client = HgClient(self.local_path)
     client.checkout(url, version='test_tag')
     self.assertEqual(client.get_current_version_label(), 'default')
     client.update(version='default')
     self.assertEqual(client.get_current_version_label(), 'default')
     client.update(version='test_branch')
     self.assertEqual(client.get_current_version_label(), 'test_branch')
开发者ID:vcstools,项目名称:vcstools,代码行数:10,代码来源:test_hg.py


示例12: test_get_url_by_reading

 def test_get_url_by_reading(self):
     url = self.local_url
     client = HgClient(self.local_path)
     client.checkout(url, self.local_version)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_url(), self.local_url)
     self.assertEqual(client.get_version(), self.local_version)
     self.assertEqual(client.get_version(self.local_version_init[0:6]), self.local_version_init)
     self.assertEqual(client.get_version("test_tag"), self.local_version_init)
开发者ID:vcstools,项目名称:vcstools,代码行数:10,代码来源:test_hg.py


示例13: test_checkout

 def test_checkout(self):
     url = self.local_url
     client = HgClient(self.local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), self.local_path)
     self.assertEqual(client.get_url(), url)
     self.assertEqual(client.get_version(), self.local_version)
开发者ID:vcstools,项目名称:vcstools,代码行数:11,代码来源:test_hg.py


示例14: test_checkout_into_subdir_without_existing_parent

 def test_checkout_into_subdir_without_existing_parent(self):
     local_path = os.path.join(self.local_path, "nonexistant_subdir")
     url = self.local_url
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
开发者ID:vcstools,项目名称:vcstools,代码行数:11,代码来源:test_hg.py


示例15: test_get_url_by_reading

 def test_get_url_by_reading(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_url(), self.readonly_url)
     self.assertEqual(client.get_version(), self.readonly_version)
     self.assertEqual(client.get_version(self.readonly_version_init[0:6]), self.readonly_version_init+'+')
     self.assertEqual(client.get_version("test_tag"), self.readonly_version_init+'+')
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:9,代码来源:test_hg.py


示例16: test_get_branches

    def test_get_branches(self):
        client = HgClient(self.local_path)
        # Make a local branch
        subprocess.check_call('hg branch test_branch2', shell=True,
                              cwd=self.local_path, stdout=subprocess.PIPE)
        subprocess.check_call('hg commit -m "Making test_branch2"', shell=True,
                              cwd=self.local_path, stdout=subprocess.PIPE)
        self.assertEqual(client.get_branches(), ['test_branch2', 'test_branch', 'default'])

        # Make a remote branch
        subprocess.check_call('hg branch remote_branch', shell=True,
                              cwd=self.remote_path, stdout=subprocess.PIPE)
        subprocess.check_call("touch fixed.txt", shell=True,
                              cwd=self.remote_path)
        subprocess.check_call("hg add fixed.txt", shell=True,
                              cwd=self.remote_path)
        subprocess.check_call("hg commit -m initial", shell=True,
                              cwd=self.remote_path)
        self.assertEqual(client.get_branches(local_only=True), ['test_branch2', 'test_branch', 'default'])
        self.assertEqual(client.get_branches(), ['remote_branch', 'test_branch2', 'test_branch', 'default'])
开发者ID:vcstools,项目名称:vcstools,代码行数:20,代码来源:test_hg.py


示例17: setUp

    def setUp(self):
        from vcstools.hg import HgClient
        directory = tempfile.mkdtemp()
        self.directories = dict(setUp=directory)
        remote_path = os.path.join(directory, "remote")
        os.makedirs(remote_path)

        # create a "remote" repo
        subprocess.check_call(["hg", "init"], cwd=remote_path)
        subprocess.check_call(["touch", "fixed.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "add", "fixed.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "commit", "-m", "initial"], cwd=remote_path)
        
        po = subprocess.Popen(["hg", "log", "--template", "'{node|short}'", "-l1"], cwd=remote_path, stdout=subprocess.PIPE)
        self.readonly_version_init = po.stdout.read().rstrip("'").lstrip("'")
        # in hg, tagging creates an own changeset, so we need to fetch version before tagging
        subprocess.check_call(["hg", "tag", "test_tag"], cwd=remote_path)

        
        # files to be modified in "local" repo
        subprocess.check_call(["touch", "modified.txt"], cwd=remote_path)
        subprocess.check_call(["touch", "modified-fs.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "add", "modified.txt", "modified-fs.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "commit", "-m", "initial"], cwd=remote_path)
        po = subprocess.Popen(["hg", "log", "--template", "'{node|short}'", "-l1"], cwd=remote_path, stdout=subprocess.PIPE)
        self.readonly_version_second = po.stdout.read().rstrip("'").lstrip("'")
        
        subprocess.check_call(["touch", "deleted.txt"], cwd=remote_path)
        subprocess.check_call(["touch", "deleted-fs.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "add", "deleted.txt", "deleted-fs.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "commit", "-m", "modified"], cwd=remote_path)
        po = subprocess.Popen(["hg", "log", "--template", "'{node|short}'", "-l1"], cwd=remote_path, stdout=subprocess.PIPE)
        self.readonly_version = po.stdout.read().rstrip("'").lstrip("'")

        self.readonly_path = os.path.join(directory, "readonly")
        self.readonly_url = remote_path
        
        client = HgClient(self.readonly_path)
        self.assertTrue(client.checkout(remote_path, self.readonly_version))
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:39,代码来源:test_hg.py


示例18: test_checkout_into_subdir_without_existing_parent

 def test_checkout_into_subdir_without_existing_parent(self): # test for #3497
     from vcstools.hg import HgClient
     directory = tempfile.mkdtemp()
     self.directories["checkout_test"] = directory
     local_path = os.path.join(directory, "anyvc", "nonexistant_subdir")
     url = self.readonly_url
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:15,代码来源:test_hg.py


示例19: test_get_remote_version

    def test_get_remote_version(self):
        url = self.local_url
        version = self.local_version
        client = HgClient(self.local_path)
        client.checkout(url, version='default')
        self.assertEqual(client.get_remote_version(fetch=True), self.local_version)
        self.assertEqual(client.get_version(), self.local_version)

        for cmd in [
                "hg checkout default",
                "touch remote_new.txt",
                "hg add remote_new.txt",
                "hg commit -m remote_new"]:
            subprocess.check_call(cmd, shell=True, cwd=self.remote_path)
        po = subprocess.Popen("hg log --template '{node|short}' -l1", shell=True, cwd=self.remote_path, stdout=subprocess.PIPE)
        remote_new_version = po.stdout.read().decode('UTF-8').rstrip("'").lstrip("'")
        self.assertNotEqual(self.local_version, remote_new_version)

        self.assertEqual(client.get_remote_version(fetch=False), self.local_version)
        self.assertEqual(client.get_remote_version(fetch=True), remote_new_version)
        self.assertEqual(client.get_remote_version(fetch=False), remote_new_version)
        self.assertEqual(client.get_version(), self.local_version)
开发者ID:vcstools,项目名称:vcstools,代码行数:22,代码来源:test_hg.py


示例20: testDiffClean

 def testDiffClean(self):
     client = HgClient(self.remote_path)
     self.assertEquals('', client.get_diff())
开发者ID:vcstools,项目名称:vcstools,代码行数:3,代码来源:test_hg.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python svn.SvnClient类代码示例发布时间:2022-05-26
下一篇:
Python git.GitClient类代码示例发布时间: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