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

Python svn.SvnClient类代码示例

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

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



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

示例1: 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 = SvnClient(local_path)
     self.assertTrue('version' in client.get_environment_metadata())
开发者ID:jpgr87,项目名称:vcstools,代码行数:7,代码来源:test_svn.py


示例2: test_diff

    def test_diff(self):
        client = SvnClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEqualDiffs('Index: added.txt\n===================================================================\n--- added.txt\t(revision 0)\n+++ added.txt\t(revision 0)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\nIndex: modified-fs.txt\n===================================================================\n--- modified-fs.txt\t(revision 3)\n+++ modified-fs.txt\t(working copy)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\nIndex: modified.txt\n===================================================================\n--- modified.txt\t(revision 3)\n+++ modified.txt\t(working copy)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file',
                          client.get_diff().rstrip())
开发者ID:jamuraa,项目名称:vcstools,代码行数:7,代码来源:test_svn.py


示例3: test_get_remote_branch_version

 def test_get_remote_branch_version(self):
     url = self.branch_url
     client = SvnClient(self.local_path)
     client.checkout(url)
     self.assertEqual(client.get_remote_version(fetch=True),
                      self.local_version_foo_branch)
     self.assertEqual(client.get_remote_version(fetch=False),
                      None)
开发者ID:jpgr87,项目名称:vcstools,代码行数:8,代码来源:test_svn.py


示例4: test_checkout_dir_exists

 def test_checkout_dir_exists(self):
     url = self.local_url
     client = SvnClient(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:jpgr87,项目名称:vcstools,代码行数:8,代码来源:test_svn.py


示例5: test_get_affected_files

    def test_get_affected_files(self):
        client = SvnClient(self.local_path)
        client.checkout(self.local_url)
        log = client.get_log(limit=1)[0]
        affected = client.get_affected_files(log['id'])

        self.assertEqual(sorted(['deleted-fs.txt', 'deleted.txt']),
                         sorted(affected))
开发者ID:mocudev,项目名称:vcstools,代码行数:8,代码来源:test_svn.py


示例6: test_diff_relpath

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

        print 'Index: readonly/added.txt\n===================================================================\n--- readonly/added.txt\t(revision 0)\n+++ readonly/added.txt\t(revision 0)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\nIndex: readonly/modified-fs.txt\n===================================================================\n--- readonly/modified-fs.txt\t(revision 3)\n+++ readonly/modified-fs.txt\t(working copy)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\nIndex: readonly/modified.txt\n===================================================================\n--- readonly/modified.txt\t(revision 3)\n+++ readonly/modified.txt\t(working copy)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\n'
        print client.get_diff(basepath=os.path.dirname(self.readonly_path))
        
        self.assertEqualDiffs('Index: readonly/added.txt\n===================================================================\n--- readonly/added.txt\t(revision 0)\n+++ readonly/added.txt\t(revision 0)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\nIndex: readonly/modified-fs.txt\n===================================================================\n--- readonly/modified-fs.txt\t(revision 3)\n+++ readonly/modified-fs.txt\t(working copy)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\nIndex: readonly/modified.txt\n===================================================================\n--- readonly/modified.txt\t(revision 3)\n+++ readonly/modified.txt\t(working copy)\[email protected]@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\n', client.get_diff(basepath=os.path.dirname(self.readonly_path)))
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:10,代码来源:test_svn.py


示例7: test_export_repository

    def test_export_repository(self):
        client = SvnClient(self.local_path)
        self.assertTrue(
          client.export_repository('',
            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:jamuraa,项目名称:vcstools,代码行数:10,代码来源:test_svn.py


示例8: test_get_log_defaults

 def test_get_log_defaults(self):
     client = SvnClient(self.local_path)
     client.checkout(self.local_url)
     log = client.get_log()
     self.assertEquals(3, len(log))
     self.assertEquals('modified', log[0]['message'])
     for key in ['id', 'author', 'date', 'message']:
         self.assertTrue(log[0][key] is not None, key)
     # svn logs don't have email, but key should be in dict
     self.assertTrue(log[0]['email'] is None)
开发者ID:jamuraa,项目名称:vcstools,代码行数:10,代码来源:test_svn.py


示例9: test_checkout_emptyversion

 def test_checkout_emptyversion(self):
     url = self.local_url
     client = SvnClient(self.local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url, version=''))
     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.assertTrue(client.update(None))
     self.assertTrue(client.update(""))
开发者ID:jamuraa,项目名称:vcstools,代码行数:13,代码来源:test_svn.py


示例10: test_checkout_specific_version_and_update_short

 def test_checkout_specific_version_and_update_short(self):
     "using just a number as version"
     url = self.local_url
     version = "3"
     client = SvnClient(self.local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url, version))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_version(), "-r3")
     new_version = '2'
     self.assertTrue(client.update(new_version))
     self.assertEqual(client.get_version(), "-r2")
开发者ID:jamuraa,项目名称:vcstools,代码行数:14,代码来源:test_svn.py


示例11: test_checkout

 def test_checkout(self):
     url = self.local_url
     client = SvnClient(self.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(), self.local_path)
     self.assertEqual(client.get_url(), url)
开发者ID:jamuraa,项目名称:vcstools,代码行数:11,代码来源:test_svn.py


示例12: test_get_branches_non_canonical

 def test_get_branches_non_canonical(self):
     remote_path = os.path.join(self.root_directory, "remote_nc")
     init_path = os.path.join(self.root_directory, "init_nc")
     local_path = os.path.join(self.root_directory, "local_nc")
     # create a "remote" repo
     subprocess.check_call("svnadmin create %s" % remote_path, shell=True, cwd=self.root_directory)
     local_root_url = "file://localhost/" + remote_path
     local_url = local_root_url + "/footest"
     # create an "init" repo to populate remote repo
     subprocess.check_call("svn checkout %s %s" % (local_root_url, init_path), shell=True, cwd=self.root_directory)
     for cmd in [
         "mkdir footest",
         "mkdir footest/foosub",
         "touch footest/foosub/fixed.txt",
         "svn add footest",
         "svn commit -m initial"]:
         subprocess.check_call(cmd, shell=True, cwd=init_path)
     client = SvnClient(local_path)
     client.checkout(local_url)
     self.assertEqual([], client.get_branches())
开发者ID:jpgr87,项目名称:vcstools,代码行数:20,代码来源:test_svn.py


示例13: setUpClass

 def setUpClass(self):
     SvnClientTestSetups.setUpClass()
     client = SvnClient(self.local_path)
     client.checkout(self.local_url)
     # after setting up "local" repo, change files and make some changes
     subprocess.check_call("rm deleted-fs.txt", shell=True, cwd=self.local_path)
     subprocess.check_call("svn rm deleted.txt", shell=True, cwd=self.local_path)
     f = io.open(os.path.join(self.local_path, "modified.txt"), 'a')
     f.write('0123456789abcdef')
     f.close()
     f = io.open(os.path.join(self.local_path, "modified-fs.txt"), 'a')
     f.write('0123456789abcdef')
     f.close()
     f = io.open(os.path.join(self.local_path, "added-fs.txt"), 'w')
     f.write('0123456789abcdef')
     f.close()
     f = io.open(os.path.join(self.local_path, "added.txt"), 'w')
     f.write('0123456789abcdef')
     f.close()
     subprocess.check_call("svn add added.txt", shell=True, cwd=self.local_path)
开发者ID:jamuraa,项目名称:vcstools,代码行数:20,代码来源:test_svn.py


示例14: test_checkout

 def test_checkout(self):
     from vcstools.svn import SvnClient
     directory = tempfile.mkdtemp()
     self.directories["checkout_test"] = directory
     local_path = os.path.join(directory, "ros")
     url = self.readonly_url
     client = SvnClient(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_svn.py


示例15: setUp

    def setUp(self):
        from vcstools.svn import SvnClient
        directory = tempfile.mkdtemp()
        self.directories = dict(setUp=directory)
        remote_path = os.path.join(directory, "remote")
        init_path = os.path.join(directory, "remote")
        
        # create a "remote" repo
        subprocess.check_call(["svnadmin", "create", remote_path], cwd=directory)
        self.readonly_url = "file://localhost"+remote_path
        
        # create an "init" repo to feed remote repo
        subprocess.check_call(["svn", "checkout", self.readonly_url, init_path], cwd=directory)
        
        subprocess.check_call(["touch", "fixed.txt"], cwd=init_path)
        subprocess.check_call(["svn", "add", "fixed.txt"], cwd=init_path)
        subprocess.check_call(["svn", "commit", "-m", "initial"], cwd=init_path)
                
        self.readonly_version_init = "-r1"
        
        # files to be modified in "local" repo
        subprocess.check_call(["touch", "modified.txt"], cwd=init_path)
        subprocess.check_call(["touch", "modified-fs.txt"], cwd=init_path)
        subprocess.check_call(["svn", "add", "modified.txt", "modified-fs.txt"], cwd=init_path)
        subprocess.check_call(["svn", "commit", "-m", "initial"], cwd=init_path)
        
        self.readonly_version_second = "-r2"
        
        subprocess.check_call(["touch", "deleted.txt"], cwd=init_path)
        subprocess.check_call(["touch", "deleted-fs.txt"], cwd=init_path)
        subprocess.check_call(["svn", "add", "deleted.txt", "deleted-fs.txt"], cwd=init_path)
        subprocess.check_call(["svn", "commit", "-m", "modified"], cwd=init_path)
        
        self.readonly_version = "-r3"

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


示例16: test_get_url_by_reading

 def test_get_url_by_reading(self):
     from vcstools.svn import SvnClient
     client = SvnClient(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("PREV"), "-r2")
     self.assertEqual(client.get_version("2"), "-r2")
开发者ID:130s,项目名称:dry_prerelease_job_generator,代码行数:9,代码来源:test_svn.py


示例17: test_get_branches

    def test_get_branches(self):
        client = SvnClient(self.local_path)

        self.assertEqual(['foo'], client.get_branches())

        # slyly create some empty branches
        subprocess.check_call("mkdir -p branches/foo2", shell=True, cwd=self.init_path)
        subprocess.check_call("mkdir -p branches/bar", shell=True, cwd=self.init_path)
        subprocess.check_call("svn add branches/foo2", shell=True, cwd=self.init_path)
        subprocess.check_call("svn add branches/bar", shell=True, cwd=self.init_path)
        subprocess.check_call("svn commit -m newbranches", shell=True, cwd=self.init_path)
        self.assertEqual([], client.get_branches(local_only=True))
        self.assertEqual(['bar', 'foo', 'foo2'], client.get_branches())

        # checkout branch foo
        local_path2 = os.path.join(self.root_directory, "local_foo")
        client = SvnClient(local_path2)
        client.checkout(self.local_root_url + '/branches/foo')
        self.assertEqual(['foo'], client.get_branches(local_only=True))
开发者ID:jpgr87,项目名称:vcstools,代码行数:19,代码来源:test_svn.py


示例18: testDiffClean

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


示例19: test_status_untracked

 def test_status_untracked(self):
     client = SvnClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertStatusListEqual('?       added-fs.txt\nA       added.txt\nD       deleted.txt\nM       modified-fs.txt\n!       deleted-fs.txt\nM       modified.txt\n', client.get_status(untracked=True))
开发者ID:jamuraa,项目名称:vcstools,代码行数:5,代码来源:test_svn.py


示例20: test_status_relpath

 def test_status_relpath(self):
     client = SvnClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertStatusListEqual('A       local/added.txt\nD       local/deleted.txt\nM       local/modified-fs.txt\n!       local/deleted-fs.txt\nM       local/modified.txt\n', client.get_status(basepath=os.path.dirname(self.local_path)))
开发者ID:jamuraa,项目名称:vcstools,代码行数:5,代码来源:test_svn.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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