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


Python wstool_cli.wstool_main函数代码示例

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


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

示例1: setUp

    def setUp(self):
        AbstractSCMTest.setUp(self)
        self.remote_path = os.path.join(self.test_root_path, "remote")
        os.makedirs(self.remote_path)

        # create a "remote" repo
        subprocess.check_call(["git", "init"], cwd=self.remote_path)
        subprocess.check_call(["touch", "test.txt"], cwd=self.remote_path)
        subprocess.check_call(["git", "add", "*"], cwd=self.remote_path)
        subprocess.check_call(["git", "commit", "-m", "modified"], cwd=self.remote_path)
        po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=self.remote_path, stdout=subprocess.PIPE)
        self.version_init = po.stdout.read().decode('UTF-8').rstrip('"').lstrip('"')[0:12]
        subprocess.check_call(["git", "tag", "footag"], cwd=self.remote_path)
        subprocess.check_call(["touch", "test2.txt"], cwd=self.remote_path)
        subprocess.check_call(["git", "add", "*"], cwd=self.remote_path)
        subprocess.check_call(["git", "commit", "-m", "modified"], cwd=self.remote_path)
        po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=self.remote_path, stdout=subprocess.PIPE)
        self.version_end = po.stdout.read().decode('UTF-8').rstrip('"').lstrip('"')[0:12]

        # wstool the remote repo and fake ros
        _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: clone, uri: ../remote}")
        self.clone_path = os.path.join(self.local_path, "clone")

        cmd = ["wstool", "update"]
        os.chdir(self.local_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        sys.stdout = sys.__stdout__
开发者ID:cbandera,项目名称:wstool,代码行数:29,代码来源:test_diff_functions_git.py

示例2: setUp

    def setUp(self):
        AbstractSCMTest.setUp(self)
        remote_path = os.path.join(self.test_root_path, "remote")
        os.makedirs(remote_path)

        # create a "remote" repo
        subprocess.check_call(["hg", "init"], cwd=remote_path)
        subprocess.check_call(["touch", "test.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "add", "test.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.version_init = po.stdout.read().decode('UTF-8').rstrip("'").lstrip("'")
        subprocess.check_call(["hg", "tag", "footag"], cwd=remote_path)
        subprocess.check_call(["touch", "test2.txt"], cwd=remote_path)
        subprocess.check_call(["hg", "add", "test2.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.version_end = po.stdout.read().decode('UTF-8').rstrip("'").lstrip("'")

        # wstool the remote repo and fake ros
        _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- hg: {local-name: clone, uri: ../remote}")

        cmd = ["wstool", "update"]
        os.chdir(self.local_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        sys.stdout = sys.__stdout__
开发者ID:cbandera,项目名称:wstool,代码行数:28,代码来源:test_diff_functions_hg.py

示例3: setUp

    def setUp(self):
        AbstractSCMTest.setUp(self)
        remote_path = os.path.join(self.test_root_path, "remote")
        os.makedirs(remote_path)

        # create a "remote" repo
        subprocess.check_call(["bzr", "init"], cwd=remote_path)
        subprocess.check_call(["touch", "test.txt"], cwd=remote_path)
        subprocess.check_call(["bzr", "add", "test.txt"], cwd=remote_path)
        subprocess.check_call(["bzr", "commit", "-m", "modified"], cwd=remote_path)
        self.version_init = "1"
        subprocess.check_call(["bzr", "tag", "footag"], cwd=remote_path)
        subprocess.check_call(["touch", "test2.txt"], cwd=remote_path)
        subprocess.check_call(["bzr", "add", "test2.txt"], cwd=remote_path)
        subprocess.check_call(["bzr", "commit", "-m", "modified"], cwd=remote_path)
        self.version_end = "2"

        # wstool the remote repo and fake ros
        _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- bzr: {local-name: clone, uri: ../remote}")

        cmd = ["wstool", "update"]
        os.chdir(self.local_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        sys.stdout = sys.__stdout__
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:26,代码来源:test_diff_functions_bzr.py

示例4: setUp

    def setUp(self):
        AbstractSCMTest.setUp(self)
        remote_path = os.path.join(self.test_root_path, "remote")
        filler_path = os.path.join(self.test_root_path, "filler")
        self.svn_uri = "file://localhost" + remote_path

        # create a "remote" repo
        subprocess.check_call(["svnadmin", "create", remote_path], cwd=self.test_root_path)
        subprocess.check_call(["svn", "checkout", self.svn_uri, filler_path], cwd=self.test_root_path)
        subprocess.check_call(["touch", "test.txt"], cwd=filler_path)
        subprocess.check_call(["svn", "add", "test.txt"], cwd=filler_path)
        subprocess.check_call(["svn", "commit", "-m", "modified"], cwd=filler_path)
        subprocess.check_call(["touch", "test2.txt"], cwd=filler_path)
        subprocess.check_call(["svn", "add", "test2.txt"], cwd=filler_path)
        subprocess.check_call(["svn", "commit", "-m", "modified"], cwd=filler_path)

        self.version_init = "-r1"
        self.version_end = "-r2"

        # wstool the remote repo and fake ros
        _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- svn: {local-name: clone, uri: '" + self.svn_uri + "'}")

        cmd = ["wstool", "update"]
        os.chdir(self.local_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        sys.stdout = sys.__stdout__
开发者ID:jpgr87,项目名称:wstool,代码行数:28,代码来源:test_diff_functions_svn.py

示例5: setUpClass

    def setUpClass(self):
        AbstractSCMTest.setUpClass()
        self.remote_path = os.path.join(self.test_root_path, 'remote')
        self.new_remote_path = os.path.join(self.test_root_path, 'fooo')
        self.version = 'master'
        self.branch = 'test_branch'
        self.date = datetime.date.today().isoformat()
        os.makedirs(self.remote_path)

        create_git_repo(self.remote_path)

        # wstool the remote repo and fake ros
        entry = '''\
- other: {local-name: ../ros}
- git: {local-name: clone, uri: ../remote, version: %s}
''' % self.version
        _add_to_file(os.path.join(self.local_path, '.rosinstall'), entry)

        cmd = ['wstool', 'update', '-t', 'ws']
        os.chdir(self.test_root_path)
        wstool_main(cmd)

        self.clone_path = os.path.join(self.local_path, 'clone')

        modify_git_repo(self.clone_path)

        subprocess.check_call(['git', 'checkout', '-b', self.branch],
                              cwd=self.clone_path)
        subprocess.check_call(['git', 'remote', 'set-url', 'origin',
                               self.new_remote_path], cwd=self.clone_path)
开发者ID:cottsay,项目名称:wstool,代码行数:30,代码来源:test_export.py

示例6: test_rosinstall_invalid_fail

 def test_rosinstall_invalid_fail(self):
     cmd = copy.copy(self.wstool_fn)
     cmd.extend([self.directory, "init", self.broken_rosinstall])
     try:
         wstool_main(cmd)
         self.fail("expected exception")
     except MultiProjectException:
         pass
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:8,代码来源:test_rosinstall_options.py

示例7: test_rosinstall_delete_changes

 def test_rosinstall_delete_changes(self):
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["init", self.directory, self.simple_rosinstall])
     self.assertEqual(0, wstool_main(cmd))
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["merge", "-t", self.directory, self.simple_changed_uri_rosinstall, "--merge-replace", "-y"])
     self.assertEqual(0, wstool_main(cmd))
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["update", "-t", self.directory, "--delete-changed-uri"])
     self.assertEqual(0, wstool_main(cmd))
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:10,代码来源:test_rosinstall_options.py

示例8: test_wstool_info_svn

    def test_wstool_info_svn(self):
        cmd = ["wstool", "info", "-t", "ws"]
        os.chdir(self.test_root_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        tokens = _nth_line_split(-2, output)
        self.assertEqual(['clone', 'M', 'svn'], tokens[0:3])

        cli = WstoolCLI()
        self.assertEqual(0, cli.cmd_info(os.path.join(self.test_root_path, 'ws'), []))
开发者ID:jpgr87,项目名称:wstool,代码行数:11,代码来源:test_diff_functions_svn.py

示例9: test_wstool_status_hg_untracked

    def test_wstool_status_hg_untracked(self):
        """Test untracked status output for hg when run outside workspace"""
        cmd = ["wstool", "status", "-t", "ws", "--untracked"]
        os.chdir(self.test_root_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        sys.stdout = sys.__stdout__
        output = output.getvalue()
        self.assertEqual('M       clone/modified-fs.txt\nM       clone/modified.txt\nA       clone/added.txt\nR       clone/deleted.txt\n!       clone/deleted-fs.txt\n?       clone/added-fs.txt\n', output)

        cli = WstoolCLI()
        self.assertEqual(0, cli.cmd_status(os.path.join(self.test_root_path, 'ws'), ["--untracked"]))
开发者ID:cbandera,项目名称:wstool,代码行数:12,代码来源:test_diff_functions_hg.py

示例10: test_wstool_diff_bzr_outside

    def test_wstool_diff_bzr_outside(self):
        """Test diff output for bzr when run outside workspace"""
        cmd = ["wstool", "diff", "-t", "ws"]
        os.chdir(self.test_root_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        sys.stdout = sys.__stdout__
        output = output.getvalue()
        self.check_diff_output(output)

        cli = WstoolCLI()
        self.assertEqual(0, cli.cmd_diff(os.path.join(self.test_root_path, 'ws'), []))
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:12,代码来源:test_diff_functions_bzr.py

示例11: test_rosinstall_backup_changes

 def test_rosinstall_backup_changes(self):
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["init", self.directory, self.simple_rosinstall])
     self.assertEqual(0, wstool_main(cmd))
     directory1 = tempfile.mkdtemp()
     self.directories["backup1"] = directory1
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["merge", "-t", self.directory, self.simple_changed_uri_rosinstall, "--merge-replace", "-y"])
     self.assertEqual(0, wstool_main(cmd))
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["update",  "-t", self.directory, "--backup-changed-uri=%s" % directory1])
     self.assertEqual(0, wstool_main(cmd))
     self.assertEqual(len(os.listdir(directory1)), 1)
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:13,代码来源:test_rosinstall_options.py

示例12: test_wstool_status_svn_outside

    def test_wstool_status_svn_outside(self):
        """Test status output for svn when run outside workspace"""

        cmd = ["wstool", "status", "-t", "ws"]
        os.chdir(self.test_root_path)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        sys.stdout = sys.__stdout__
        output = output.getvalue()
        self.assertStatusListEqual('A       clone/added.txt\nD       clone/deleted.txt\n!       clone/deleted-fs.txt\nM       clone/modified.txt\n', output)

        cli = WstoolCLI()
        self.assertEqual(0, cli.cmd_status(os.path.join(self.test_root_path, 'ws'), []))
开发者ID:jpgr87,项目名称:wstool,代码行数:13,代码来源:test_diff_functions_svn.py

示例13: test_wstool_diff_git_inside

    def test_wstool_diff_git_inside(self):
        """Test diff output for git when run inside workspace"""
        directory = self.test_root_path + "/ws"
        cmd = ["wstool", "diff"]
        os.chdir(directory)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        sys.stdout = sys.__stdout__
        self.check_diff_output(output)

        cli = WstoolCLI()
        self.assertEqual(0, cli.cmd_diff(directory, []))
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:13,代码来源:test_diff_functions_git.py

示例14: test_wstool_status_hg_inside

    def test_wstool_status_hg_inside(self):
        """Test status output for hg when run inside workspace"""
        directory = self.test_root_path + "/ws"

        cmd = ["wstool", "status"]
        os.chdir(directory)
        sys.stdout = output = StringIO()
        wstool_main(cmd)
        output = output.getvalue()
        sys.stdout = sys.__stdout__
        self.assertEqual('M       clone/modified-fs.txt\nM       clone/modified.txt\nA       clone/added.txt\nR       clone/deleted.txt\n!       clone/deleted-fs.txt\n', output)

        cli = WstoolCLI()
        self.assertEqual(0, cli.cmd_diff(directory, []))
开发者ID:cbandera,项目名称:wstool,代码行数:14,代码来源:test_diff_functions_hg.py

示例15: test_rosinstall_abort_changes

 def test_rosinstall_abort_changes(self):
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["init", self.directory, self.simple_rosinstall])
     self.assertEqual(0, wstool_main(cmd))
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["merge", "-t", self.directory, self.simple_changed_uri_rosinstall, "--merge-replace", "-y"])
     self.assertEqual(0, wstool_main(cmd))
     cmd = copy.copy(self.wstool_fn)
     cmd.extend(["update", "-t", self.directory, "--abort-changed-uri"])
     try:
         wstool_main(cmd)
         self.fail("expected exception")
     except MultiProjectException:
         pass
开发者ID:NikolausDemmel,项目名称:wstool,代码行数:14,代码来源:test_rosinstall_options.py


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