本文整理汇总了Python中wstool.wstool_cli.wstool_main函数的典型用法代码示例。如果您正苦于以下问题:Python wstool_main函数的具体用法?Python wstool_main怎么用?Python wstool_main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wstool_main函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: helper
def helper(self, spec, exact, expected_output):
cmd = ['wstool', 'export', '-t', 'ws']
if spec:
cmd += ['--spec']
if exact:
cmd += ['--exact']
os.chdir(self.test_root_path)
sys.stdout = output = StringIO()
wstool_main(cmd)
sys.stdout = sys.__stdout__
output = output.getvalue().encode('utf-8')
expected_output = expected_output.encode('utf-8')
self.assertEqual(expected_output, output)
开发者ID:cottsay,项目名称:wstool,代码行数:14,代码来源:test_export.py
示例17: test_rosinstall_detailed_locapath_info
def test_rosinstall_detailed_locapath_info(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', 'hg', 'default', '(-)', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens)
clone_path = os.path.join(self.local_path, "clone")
# make local modifications check
subprocess.check_call(["hg", "rm", "test2.txt"], cwd=clone_path)
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', 'hg', 'default', '(-)', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens)
subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path)
_add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- hg: {local-name: clone, uri: ../remote, version: \"footag\"}")
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', 'MV', 'hg', 'default', '(footag)', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens)
subprocess.check_call(["rm", "-rf", "clone"], cwd=self.local_path)
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', 'x', 'hg', '(footag)', os.path.join(self.test_root_path, 'remote')], tokens)
开发者ID:cbandera,项目名称:wstool,代码行数:35,代码来源:test_diff_functions_hg.py
示例18: setUpClass
def setUpClass(self):
AbstractSCMTest.setUpClass()
remote_path = os.path.join(self.test_root_path, "remote")
os.makedirs(remote_path)
create_git_repo(remote_path)
self.rosinstall_filename = os.path.join(self.local_path, "shallow-test.rosinstall")
_add_to_file(self.rosinstall_filename, "- git: {local-name: clone, uri: \"file://" + remote_path + "\"}")
cmd = ["wstool", "init", "ws-without-shallow", self.rosinstall_filename]
os.chdir(self.test_root_path)
wstool_main(cmd)
cmd = ["wstool", "init", "--shallow", "ws-with-shallow", self.rosinstall_filename]
os.chdir(self.test_root_path)
wstool_main(cmd)
开发者ID:cottsay,项目名称:wstool,代码行数:17,代码来源:test_shallow_checkout_git.py
示例19: setUpClass
def setUpClass(self):
AbstractSCMTest.setUpClass()
remote_path = os.path.join(self.test_root_path, "remote")
os.makedirs(remote_path)
create_hg_repo(remote_path)
# 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", "-t", "ws"]
os.chdir(self.test_root_path)
wstool_main(cmd)
clone_path = os.path.join(self.local_path, "clone")
modify_hg_repo(clone_path)
开发者ID:cbandera,项目名称:wstool,代码行数:17,代码来源:test_diff_functions_hg.py
示例20: setUpClass
def setUpClass(self):
AbstractSCMTest.setUpClass()
remote_path = os.path.join(self.test_root_path, "remote")
filler_path = os.path.join(self.test_root_path, "filler")
svn_uri = "file://localhost" + remote_path
create_svn_repo(self.test_root_path, remote_path, filler_path, svn_uri)
# 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: '" + svn_uri + "'}")
cmd = ["wstool", "update", "-t", "ws"]
os.chdir(self.test_root_path)
wstool_main(cmd)
clone_path = os.path.join(self.local_path, "clone")
modify_svn_repo(clone_path)
开发者ID:jpgr87,项目名称:wstool,代码行数:18,代码来源:test_diff_functions_svn.py
注:本文中的wstool.wstool_cli.wstool_main函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论