diff --git a/.travis.yml b/.travis.yml index 6c95bbf..90893b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ python: - "2.7" - "3.2" - "3.3" + - "3.4" # command to install dependencies install: # develop seems to be required by travis since 02/2013 diff --git a/setup.py b/setup.py index 04f0a87..150d346 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ def get_version(): packages=['wstool'], package_dir={'': 'src'}, # rosinstall dependency to be kept in order not to break ros hydro install instructions - install_requires=['vcstools>=0.1.34', 'pyyaml'], + install_requires=['vcstools>=0.1.37', 'pyyaml'], scripts=["scripts/wstool"], author="Tully Foote", author_email="tfoote@osrfoundation.org", diff --git a/src/wstool/cli_common.py b/src/wstool/cli_common.py index a1fe51f..678f1f8 100644 --- a/src/wstool/cli_common.py +++ b/src/wstool/cli_common.py @@ -119,6 +119,28 @@ def _uris_match(basepath, uri1, uri2): return False +def _get_svn_version_from_uri(uri): + """ + in case of SVN, we can use the final part of + standard uri as spec version, if it follows canonical SVN layout + + :param uri: uri to extract version from + :returns changed_uri: str, version extracted uri + :returns version: str, extracted version + :returns: (None, None), for empty uri or when there is no regex match for version info + """ + if uri is None: + return None, None + match = re.match('(.*/)((tags|branches|trunk)(/.*)*)', uri) + if (match is not None and + len(match.groups()) > 1 and + uri == ''.join(match.groups()[0:2])): + changed_uri = match.groups()[0] + version = match.groups()[1] + return changed_uri, version + return None, None + + def _get_status_flags(basepath, elt_dict): """ returns a string where each char conveys status information about @@ -140,6 +162,13 @@ def _get_status_flags(basepath, elt_dict): elt_dict['actualversion'] is not None and elt_dict['specversion'] != elt_dict['actualversion'])): mflag += 'V' + if ('remote_revision' in elt_dict and + elt_dict['remote_revision'] != '' and + elt_dict['remote_revision'] is not None and + elt_dict['actualversion'] is not None and + 'actualversion' in elt_dict and + elt_dict['remote_revision'] != elt_dict['actualversion']): + mflag += 'C' return mflag @@ -158,6 +187,10 @@ def get_info_table_elements(basepath, entries): line['curr_version'] = None if not 'version' in line: line['version'] = None + if not 'remote_revision' in line: + line['remote_revision'] = None + if not 'curr_version_label' in line: + line['curr_version_label'] = None output_dict = {'scm': line['scm'], 'uri': line['uri'], 'curr_uri': None, @@ -173,46 +206,31 @@ def get_info_table_elements(basepath, entries): line['specversion'] = line['specversion'][0:12] if (line['actualversion'] is not None and len(line['actualversion']) > 12): line['actualversion'] = line['actualversion'][0:12] + if (line['remote_revision'] is not None and len(line['remote_revision']) > 12): + line['remote_revision'] = line['remote_revision'][0:12] if line['scm'] is not None: if line['scm'] == 'svn': - # in case of SVN, we can use the final part of - # standard uri as version - uri = line['uri'] - version = line['version'] - match = re.match('(.*/)((tags|branches|trunk)(/.*)*)', uri) - if match is not None and len(match.groups()) > 1 and uri == ''.join(match.groups()[0:2]): - uri = match.groups()[0] - if (match.groups()[1] is not None and version is None or version.strip() == ''): - version = match.groups()[1] - else: - version = match.groups()[1] - line['uri'] = uri - line['version'] = version + (line['uri'], + line['version']) = _get_svn_version_from_uri(uri=line['uri']) if line['curr_uri'] is not None: - uri = line['curr_uri'] - match = re.match('(.*/)((tags|branches|trunk)(/.*)*)', uri) - if match is not None and len(match.groups()) > 1 and uri == ''.join(match.groups()[0:2]): - uri = match.groups()[0] - if (match.groups()[1] is not None and version is None or version.strip() == ''): - version = match.groups()[1] - else: - version = match.groups()[1] - line['curr_uri'] = uri - line['curr_version'] = version - - if (line['curr_version'] is not None and - line['version'] != line['curr_version']): - - output_dict['version'] = "%s (%s)" % (line['curr_version'], line['version']) - else: - output_dict['version'] = line['version'] + (line['curr_uri'], + line['curr_version_label']) = _get_svn_version_from_uri( + uri=line['curr_uri']) + + if line['scm'] in ['git', 'svn', 'hg']: + line['curr_version'] = line['curr_version_label'] + + if line['curr_version'] is not None: + output_dict['version'] = line['curr_version'] + if output_dict['version'] is not None: + if (line['version'] != output_dict['version']): + output_dict['version'] += " (%s)" % (line['version'] or '-') if (line['specversion'] is not None and line['specversion'] != '' and line['actualversion'] != line['specversion']): - output_dict['matching'] = "%s (%s)" % (line['actualversion'], line['specversion']) else: output_dict['matching'] = line['actualversion'] @@ -263,7 +281,7 @@ def get_info_table(basepath, entries, data_only=False, reverse=False, unmanaged= 'uri': "URI (Spec) [http(s)://...]", 'scm': "SCM ", 'localname': "Localname", - 'version': "Version-Spec", + 'version': "Version (Spec)", 'matching': "UID (Spec)", 'status': "S"} @@ -332,7 +350,8 @@ def get_info_list(basepath, line, data_only=False): 'scm': "SCM:", 'localname': "Localname:", 'path': "Path", - 'version': "Version-Spec:", + 'version': "Spec-Version:", + 'curr_version_label': "Current-Version:", 'status': "Status:", 'specversion': "Spec-Revision:", 'actualversion': "Current-Revision:", @@ -341,8 +360,8 @@ def get_info_list(basepath, line, data_only=False): # table design selected_headers = ['localname', 'path', 'status', 'scm', 'uri', 'curr_uri', - 'version', 'specversion', 'actualversion', - 'properties'] + 'version', 'curr_version_label', 'specversion', + 'actualversion', 'properties'] line['status'] = _get_status_flags(basepath, line) diff --git a/src/wstool/config_elements.py b/src/wstool/config_elements.py index 398b689..44abafc 100644 --- a/src/wstool/config_elements.py +++ b/src/wstool/config_elements.py @@ -139,6 +139,7 @@ def get_diff(self, basepath=None): def get_status(self, basepath=None, untracked=False): raise NotImplementedError("ConfigElement get_status unimplemented") + def backup(self, backup_path): if not backup_path: raise MultiProjectException( @@ -396,7 +397,7 @@ def get_path_spec(self): version=version, tags=self.get_properties()) - def get_versioned_path_spec(self): + def get_versioned_path_spec(self, fetch=False): "yaml looking up current version" version = self.version if version == '': @@ -406,6 +407,8 @@ def get_versioned_path_spec(self): # revision is the UID of the version spec, can be them same revision = self._get_vcsc().get_version(self.version) currevision = self._get_vcsc().get_version() + remote_revision = self._get_vcsc().get_remote_version(fetch=fetch) + curr_version = self._get_vcsc().get_current_version_label() uri = self.uri curr_uri = self._get_vcsc().get_url() # uri might be a shorthand notation equivalent to curr_uri @@ -416,8 +419,10 @@ def get_versioned_path_spec(self): scmtype=self.get_vcs_type_name(), uri=self.uri, version=version, + curr_version=curr_version, revision=revision, currevision=currevision, + remote_revision=remote_revision, curr_uri=curr_uri, tags=self.get_properties()) diff --git a/src/wstool/config_yaml.py b/src/wstool/config_yaml.py index 4d27e0b..0c26c50 100644 --- a/src/wstool/config_yaml.py +++ b/src/wstool/config_yaml.py @@ -183,9 +183,11 @@ def __init__(self, scmtype=None, uri=None, version=None, + curr_version=None, tags=None, revision=None, currevision=None, + remote_revision=None, path=None, curr_uri=None): """ @@ -194,6 +196,7 @@ def __init__(self, :param scmtype: one of __ALLTYPES__ :param uri: uri from config file :param version: version label from config file (branchname, tagname, sha-id) + :param cur_version: version information label(s) from VCS (branchname, remote, tracking branch) :param tags: arbirtrary meta-information (used for ROS package indexing) :param revision: unique id of label stored in version :param currrevision: unique id of actual version in file system @@ -205,10 +208,12 @@ def __init__(self, self._uri = uri self._curr_uri = curr_uri self._version = version + self._curr_version = curr_version self._scmtype = scmtype self._tags = tags or [] self._revision = revision self._currevision = currevision + self._remote_revision = remote_revision def __str__(self): return str(self.get_legacy_yaml()) @@ -231,8 +236,10 @@ def detach_vcs_info(self): self._scmtype = None self._uri = None self._version = None + self._curr_version = None self._revision = None self._currevision = None + self._remote_revision = None def get_legacy_type(self): """return one of __ALLTYPES__""" @@ -286,12 +293,18 @@ def get_scmtype(self): def get_version(self): return self._version + def get_curr_version(self): + return self._curr_version + def get_revision(self): return self._revision def get_current_revision(self): return self._currevision + def get_remote_revision(self): + return self._remote_revision + def get_uri(self): return self._uri @@ -310,7 +323,7 @@ def get_path_spec_from_yaml(yaml_dict): tags = [] if type(yaml_dict) != dict: raise MultiProjectException( - "Yaml for each element must be in YAML dict form") + "Yaml for each element must be in YAML dict form: %s " % yaml_dict) # old syntax: # - hg: {local-name: common_rosdeps, # version: common_rosdeps-1.0.2, diff --git a/src/wstool/multiproject_cli.py b/src/wstool/multiproject_cli.py index 8940b84..13f82a4 100644 --- a/src/wstool/multiproject_cli.py +++ b/src/wstool/multiproject_cli.py @@ -993,6 +993,7 @@ def cmd_info(self, target_path, argv, reverse=True, config=None): x for missing L for uncommited (local) changes V for difference in version and/or remote URI + C for difference in local and remote versions The 'Version-Spec' column shows what tag, branch or revision was given in the .rosinstall file. The 'UID' column shows the unique ID of the @@ -1031,6 +1032,10 @@ def cmd_info(self, target_path, argv, reverse=True, config=None): "--yaml", dest="yaml", default=False, help="Shows only version of single entry. Intended for scripting.", action="store_true") + parser.add_option( + "--fetch", dest="fetch", default=False, + help="When used, retrieves version information from remote (takes longer).", + action="store_true") parser.add_option( "-u", "--untracked", dest="untracked", default=False, @@ -1081,7 +1086,8 @@ def cmd_info(self, target_path, argv, reverse=True, config=None): # this call takes long, as it invokes scms. outputs = multiproject_cmd.cmd_info(config, localnames=args, - untracked=options.untracked) + untracked=options.untracked, + fetch=options.fetch) if args and len(args) == 1: # if only one element selected, print just one line print(get_info_list(config.get_base_path(), diff --git a/src/wstool/multiproject_cmd.py b/src/wstool/multiproject_cmd.py index fa887f8..2e8ce65 100644 --- a/src/wstool/multiproject_cmd.py +++ b/src/wstool/multiproject_cmd.py @@ -392,7 +392,7 @@ def cmd_snapshot(config, localnames=None): return source_aggregate -def cmd_info(config, localnames=None, untracked=False): +def cmd_info(config, localnames=None, untracked=False, fetch=False): """This function compares what should be (config_file) with what is (directories) and returns a list of dictionary giving each local path and all the state information about it available. @@ -403,9 +403,10 @@ class InfoRetriever(): Auxilliary class to perform IO-bound operations in individual threads """ - def __init__(self, element, path, untracked): + def __init__(self, element, path, untracked, fetch): self.element = element self.path = path + self.fetch = fetch self.untracked = untracked def do_work(self): @@ -415,8 +416,11 @@ def do_work(self): curr_uri = None exists = False version = "" # what is given in config file + curr_version_label = "" # e.g. branchname + remote_revision = "" # UID on remote + display_version = '' modified = "" - actualversion = "" # revision number of version + currevision = "" # revision number of version specversion = "" # actual revision number localname = self.element.get_local_name() path = self.element.get_path() or localname @@ -431,8 +435,15 @@ def do_work(self): path_spec = self.element.get_path_spec() version = path_spec.get_version() else: - path_spec = self.element.get_versioned_path_spec() + path_spec = self.element.get_versioned_path_spec(fetch=fetch) version = path_spec.get_version() + remote_revision = path_spec.get_remote_revision() + curr_version_label = path_spec.get_curr_version() + if (curr_version_label is not None and + version != curr_version_label): + display_version = curr_version_label + else: + display_version = version curr_uri = path_spec.get_curr_uri() status = self.element.get_status(self.path, self.untracked) if (status is not None and @@ -442,9 +453,8 @@ def do_work(self): if (version is not None and version.strip() != '' and (specversion is None or specversion.strip() == '')): - specversion = '"%s"' % version - actualversion = path_spec.get_current_revision() + currevision = path_spec.get_current_revision() scm = path_spec.get_scmtype() uri = path_spec.get_uri() return {'scm': scm, @@ -454,8 +464,10 @@ def do_work(self): 'uri': uri, 'curr_uri': curr_uri, 'version': version, + 'remote_revision': remote_revision, + 'curr_version_label': curr_version_label, 'specversion': specversion, - 'actualversion': actualversion, + 'actualversion': currevision, 'modified': modified, 'properties': self.element.get_properties()} @@ -466,7 +478,7 @@ def do_work(self): work = DistributedWork(capacity=len(elements), num_threads=-1) for element in elements: if element.get_properties() is None or not 'setup-file' in element.get_properties(): - work.add_thread(InfoRetriever(element, path, untracked)) + work.add_thread(InfoRetriever(element, path, untracked, fetch)) outputs = work.run() return outputs diff --git a/test/local/mock_client.py b/test/local/mock_client.py index 72c5c1d..3c66060 100644 --- a/test/local/mock_client.py +++ b/test/local/mock_client.py @@ -47,7 +47,8 @@ def __init__(self, vcs_presence=False, url="mockurl", actualversion=None, - specversion=None): + specversion=None, + remoteversion=None): self.scmtype = scmtype self.path_exists_flag = path_exists self.checkout_success = checkout_success @@ -58,6 +59,7 @@ def __init__(self, self.updated = False self.actualversion = actualversion self.specversion = specversion + self.remoteversion = remoteversion def get_vcs_type_name(self): return self.scmtype @@ -71,6 +73,12 @@ def get_version(self, revision=None): else: return self.specversion + def get_remote_version(self, fetch=False): + return self.remoteversion + + def get_current_version_label(self): + return self.scmtype + "mockcurrentversionlabel" + def get_status(self, basepath=None, untracked=False): return self.scmtype + " mockstatus%s,%s" % (basepath, untracked) diff --git a/test/local/test_cli.py b/test/local/test_cli.py index 54cbe3e..b1c2a83 100644 --- a/test/local/test_cli.py +++ b/test/local/test_cli.py @@ -558,7 +558,7 @@ def test_info_table(self): 'localname': 'localname', 'specversion': None, 'actualversion': None}] - self.assertEqual(["localname", "svn", "tags/tagname", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries))) + self.assertEqual(["localname", "svn", "version", "(tags/tagname)", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries))) entries = [{'scm': 'svn', 'uri': 'https://some.svn.tags.server/some/branches/branchname', 'curr_uri': None, @@ -566,7 +566,7 @@ def test_info_table(self): 'localname': 'localname', 'specversion': None, 'actualversion': None}] - self.assertEqual(["localname", "svn", "branches/branchname", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries))) + self.assertEqual(["localname", "svn", "version", "(branches/branchname)", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries))) entries = [{'scm': 'svn', 'uri': 'https://some.svn.tags.server/some/trunk', 'curr_uri': None, @@ -574,7 +574,7 @@ def test_info_table(self): 'localname': 'localname', 'specversion': None, 'actualversion': None}] - self.assertEqual(["localname", "svn", "trunk", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries))) + self.assertEqual(["localname", "svn", "version", "(trunk)", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries))) entries = [{'scm': 'svn', 'uri': 'https://some.svn.tags.server/some/branches/branchname', 'curr_uri': 'https://some.svn.tags.server/some/tags/tagname', diff --git a/test/local/test_diff_functions_git.py b/test/local/test_diff_functions_git.py index b133421..117fb00 100644 --- a/test/local/test_diff_functions_git.py +++ b/test/local/test_diff_functions_git.py @@ -186,25 +186,26 @@ class WstoolInfoGitTest(AbstractSCMTest): def setUp(self): AbstractSCMTest.setUp(self) - remote_path = os.path.join(self.test_root_path, "remote") - os.makedirs(remote_path) + 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=remote_path) - subprocess.check_call(["touch", "test.txt"], cwd=remote_path) - subprocess.check_call(["git", "add", "*"], cwd=remote_path) - subprocess.check_call(["git", "commit", "-m", "modified"], cwd=remote_path) - po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=remote_path, stdout=subprocess.PIPE) + 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=remote_path) - subprocess.check_call(["touch", "test2.txt"], cwd=remote_path) - subprocess.check_call(["git", "add", "*"], cwd=remote_path) - subprocess.check_call(["git", "commit", "-m", "modified"], cwd=remote_path) - po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=remote_path, stdout=subprocess.PIPE) + 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) @@ -214,30 +215,58 @@ def setUp(self): sys.stdout = sys.__stdout__ def test_wstool_detailed_localpath_info(self): - cmd = ["wstool", "info", "-t", "ws"] + cmd = ["wstool", "info", "-t", "ws", "--managed-only"] 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', 'git', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens, output) + self.assertEqual(['clone', 'git', 'master', '(-)', self.version_end, self.remote_path], tokens) + + # test when remote version is different + subprocess.check_call(["git", "reset", "--hard", "HEAD~1"], cwd=self.clone_path) + sys.stdout = output = StringIO() + wstool_main(cmd) + output = output.getvalue() + tokens = _nth_line_split(-2, output) + self.assertEqual(['clone', 'C', 'git', 'master', '(-)', self.version_init, self.remote_path], tokens) + # return branch back to original revision + subprocess.check_call(["git", "reset", "--hard", self.version_end], cwd=self.clone_path) - clone_path = os.path.join(self.local_path, "clone") # make local modifications check - subprocess.check_call(["rm", "test2.txt"], cwd=clone_path) + subprocess.check_call(["rm", "test2.txt"], cwd=self.clone_path) sys.stdout = output = StringIO() wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'M', 'git', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens) + self.assertEqual(['clone', 'M', 'git', 'master', '(-)', self.version_end, self.remote_path], 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- git: {local-name: clone, uri: ../remote, version: \"footag\"}") + # test when version is different + sys.stdout = output = StringIO() + wstool_main(cmd) + output = output.getvalue() + tokens = _nth_line_split(-2, output) + self.assertEqual(['clone', 'MV', 'git', 'master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens) + # test when tracking branch is different from current branch + subprocess.check_call(["git", "checkout", "-b", "test_branch"], cwd=self.clone_path) + subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.remote", "origin"], cwd=self.clone_path) + subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.merge", "master"], cwd=self.clone_path) + sys.stdout = output = StringIO() + wstool_main(cmd) + output = output.getvalue() + tokens = _nth_line_split(-2, output) + self.assertEqual(['clone', 'MV', 'git', 'test_branch', '<', 'master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens) + # test when remote is different from origin + subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.remote", "remote2"], cwd=self.clone_path) sys.stdout = output = StringIO() wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'MV', 'git', 'footag', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens) + self.assertEqual(['clone', 'MV', 'git', 'test_branch', '<', 'remote2/master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens) + # return branch back to master + subprocess.check_call(["git", "checkout", "master"], cwd=self.clone_path) # using a denormalized local-name here subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path) @@ -246,17 +275,17 @@ def test_wstool_detailed_localpath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'MV', 'git', 'footag', self.version_end, "(%s)" % - self.version_init, os.path.join(self.test_root_path, 'remote')], tokens) + self.assertEqual(['clone', 'MV', 'git', 'master', '(footag)', self.version_end, "(%s)" % + self.version_init, self.remote_path], tokens) # using an absolute path to clone dir here subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path) - _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: '"+clone_path+"', uri: ../remote, version: \"footag\"}") + _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: '"+self.clone_path+"', uri: ../remote, version: \"footag\"}") sys.stdout = output = StringIO() wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual([clone_path, 'MV', 'git', 'footag', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens) + self.assertEqual([self.clone_path, 'MV', 'git', 'master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens) # using an absolute path here where relative path is shorter to display (also checks x for missing) subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path) @@ -265,3 +294,5 @@ def test_wstool_detailed_localpath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) + localname = os.path.join(os.path.dirname(self.local_path), 'foo') + self.assertEqual([localname, 'x', 'git', '(footag)', self.remote_path], tokens) diff --git a/test/local/test_diff_functions_hg.py b/test/local/test_diff_functions_hg.py index b502fd0..86f2bb6 100644 --- a/test/local/test_diff_functions_hg.py +++ b/test/local/test_diff_functions_hg.py @@ -221,7 +221,7 @@ def test_rosinstall_detailed_locapath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'hg', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens, 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 @@ -231,7 +231,7 @@ def test_rosinstall_detailed_locapath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'M', 'hg', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens) + 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\"}") @@ -240,7 +240,7 @@ def test_rosinstall_detailed_locapath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'MV', 'hg', 'footag', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens) + 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) @@ -248,4 +248,4 @@ def test_rosinstall_detailed_locapath_info(self): 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) + self.assertEqual(['clone', 'x', 'hg', '(footag)', os.path.join(self.test_root_path, 'remote')], tokens) diff --git a/test/local/test_diff_functions_svn.py b/test/local/test_diff_functions_svn.py index fc32146..c682ea6 100644 --- a/test/local/test_diff_functions_svn.py +++ b/test/local/test_diff_functions_svn.py @@ -261,7 +261,7 @@ def test_rosinstall_detailed_locapath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'MV', 'svn', '1', self.version_end, "(%s)" % self.version_init, self.svn_uri], tokens) + self.assertEqual(['clone', 'MV', 'svn', '1', '(-)', self.version_end, "(%s)" % self.version_init, self.svn_uri], tokens) subprocess.check_call(["rm", "-rf", "clone"], cwd=self.local_path) os.chdir(self.test_root_path) @@ -269,4 +269,4 @@ def test_rosinstall_detailed_locapath_info(self): wstool_main(cmd) output = output.getvalue() tokens = _nth_line_split(-2, output) - self.assertEqual(['clone', 'x', 'svn', '1', self.svn_uri], tokens) + self.assertEqual(['clone', 'x', 'svn', '(-)', self.svn_uri], tokens)