diff --git a/repo_resource/common.py b/repo_resource/common.py index 6bea21c..e23c6ef 100644 --- a/repo_resource/common.py +++ b/repo_resource/common.py @@ -270,7 +270,7 @@ def __get_remote_url(self, remote): return self.__remote_url[remote] def __get_remote_revision(self, remote): - return self.__remote_revision[remote] + return self.__remote_revision.get(remote) def set_rewrite(self, matrix: dict = None): if matrix is None: @@ -460,8 +460,10 @@ def update_manifest(self, jobs): for p in manifest.findall('project'): project = p.get('name') - projectBranch = p.get('revision') or defaultBranch projectRemote = p.get('remote') or defaultRemote + projectBranch = p.get('revision') \ + or self.__get_remote_revision(projectRemote) \ + or defaultBranch projectRemoteUrl = self.__get_remote_url(projectRemote) projects.append((projectRemote, projectRemoteUrl, project, projectBranch)) @@ -472,8 +474,10 @@ def update_manifest(self, jobs): # Update revisions for p in manifest.findall('project'): project = p.get('name') - projectBranch = p.get('revision') or defaultBranch projectRemote = p.get('remote') or defaultRemote + projectBranch = p.get('revision') \ + or self.__get_remote_revision(projectRemote) \ + or defaultBranch # find revision of the project in revisionList for url, branch, rev in revisionList: if ( diff --git a/repo_resource/test_check.py b/repo_resource/test_check.py index e1084e3..f02d3df 100644 --- a/repo_resource/test_check.py +++ b/repo_resource/test_check.py @@ -446,7 +446,7 @@ def test_include_multiple_projects_version(self): instream = StringIO(json.dumps(data)) versions = check.check(instream) - expected_version = '' # noqa: E501 + expected_version = '' # noqa: E501 version = versions[0]['version'] self.assertEqual(version, expected_version)