summaryrefslogtreecommitdiffstats
path: root/command.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2019-10-04 14:21:41 -0400
committerMike Frysinger <vapier@google.com>2019-10-08 20:15:08 +0000
commite778e57f11f208bd70c51d9cc57090a5cf9e41fa (patch)
treecbac45065ad90a79c13428064f7bbe4e400fa933 /command.py
parentf1c5dd8a0fdfa6ef916ea1befea9c44a10eae73f (diff)
downloadgit-repo-e778e57f11f208bd70c51d9cc57090a5cf9e41fa.tar.gz
command: filter projects by active manifest groupsv1.13.7
`repo forall <proj>` will look up all <proj> in the manifest for all manifest groups regardless of which are active. If <proj> is checked out to different locations depending on the group, this ultimately fails as we're unable to locate all of them. Simple fix is to only include projects that match the manifest groups that we already passed down & initialized to the active set, and that we already use when getting the default project list. Bug: https://crbug.com/gerrit/11677 Bug: https://crbug.com/1011226 Change-Id: I975f10f9a9e5a1cad7d87344123f8003732dab27 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239652 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'command.py')
-rw-r--r--command.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/command.py b/command.py
index f7d20a22..9e113f1a 100644
--- a/command.py
+++ b/command.py
@@ -175,7 +175,10 @@ class Command(object):
175 self._ResetPathToProjectMap(all_projects_list) 175 self._ResetPathToProjectMap(all_projects_list)
176 176
177 for arg in args: 177 for arg in args:
178 projects = manifest.GetProjectsWithName(arg) 178 # We have to filter by manifest groups in case the requested project is
179 # checked out multiple times or differently based on them.
180 projects = [project for project in manifest.GetProjectsWithName(arg)
181 if project.MatchesGroups(groups)]
179 182
180 if not projects: 183 if not projects:
181 path = os.path.abspath(arg).replace('\\', '/') 184 path = os.path.abspath(arg).replace('\\', '/')
@@ -200,7 +203,7 @@ class Command(object):
200 203
201 for project in projects: 204 for project in projects:
202 if not missing_ok and not project.Exists: 205 if not missing_ok and not project.Exists:
203 raise NoSuchProjectError(arg) 206 raise NoSuchProjectError('%s (%s)' % (arg, project.relpath))
204 if not project.MatchesGroups(groups): 207 if not project.MatchesGroups(groups):
205 raise InvalidProjectGroupsError(arg) 208 raise InvalidProjectGroupsError(arg)
206 209