summaryrefslogtreecommitdiffstats
path: root/subcmds/forall.py
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2021-11-18 22:40:18 +0000
committerLaMont Jones <lamontjones@google.com>2022-02-17 21:57:55 +0000
commitcc879a97c3e2614d19b15b4661c3cab4d33139c9 (patch)
tree69d225e9f0e9d79fec8f423d9c40c275f0bf3b8c /subcmds/forall.py
parent87cce68b28c34fa86895baa8d7f48307382e6c75 (diff)
downloadgit-repo-cc879a97c3e2614d19b15b4661c3cab4d33139c9.tar.gz
Add multi-manifest support with <submanifest> elementv2.22
To be addressed in another change: - a partial `repo sync` (with a list of projects/paths to sync) requires `--this-tree-only`. Change-Id: I6c7400bf001540e9d7694fa70934f8f204cb5f57 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/322657 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/forall.py')
-rw-r--r--subcmds/forall.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 7c1dea9e..cc578b52 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -168,6 +168,7 @@ without iterating through the remaining projects.
168 168
169 def Execute(self, opt, args): 169 def Execute(self, opt, args):
170 cmd = [opt.command[0]] 170 cmd = [opt.command[0]]
171 all_trees = not opt.this_manifest_only
171 172
172 shell = True 173 shell = True
173 if re.compile(r'^[a-z0-9A-Z_/\.-]+$').match(cmd[0]): 174 if re.compile(r'^[a-z0-9A-Z_/\.-]+$').match(cmd[0]):
@@ -213,11 +214,11 @@ without iterating through the remaining projects.
213 self.manifest.Override(smart_sync_manifest_path) 214 self.manifest.Override(smart_sync_manifest_path)
214 215
215 if opt.regex: 216 if opt.regex:
216 projects = self.FindProjects(args) 217 projects = self.FindProjects(args, all_manifests=all_trees)
217 elif opt.inverse_regex: 218 elif opt.inverse_regex:
218 projects = self.FindProjects(args, inverse=True) 219 projects = self.FindProjects(args, inverse=True, all_manifests=all_trees)
219 else: 220 else:
220 projects = self.GetProjects(args, groups=opt.groups) 221 projects = self.GetProjects(args, groups=opt.groups, all_manifests=all_trees)
221 222
222 os.environ['REPO_COUNT'] = str(len(projects)) 223 os.environ['REPO_COUNT'] = str(len(projects))
223 224
@@ -290,6 +291,7 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config):
290 291
291 setenv('REPO_PROJECT', project.name) 292 setenv('REPO_PROJECT', project.name)
292 setenv('REPO_PATH', project.relpath) 293 setenv('REPO_PATH', project.relpath)
294 setenv('REPO_OUTERPATH', project.RelPath(local=opt.this_manifest_only))
293 setenv('REPO_REMOTE', project.remote.name) 295 setenv('REPO_REMOTE', project.remote.name)
294 try: 296 try:
295 # If we aren't in a fully synced state and we don't have the ref the manifest 297 # If we aren't in a fully synced state and we don't have the ref the manifest
@@ -320,7 +322,7 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config):
320 output = '' 322 output = ''
321 if ((opt.project_header and opt.verbose) 323 if ((opt.project_header and opt.verbose)
322 or not opt.project_header): 324 or not opt.project_header):
323 output = 'skipping %s/' % project.relpath 325 output = 'skipping %s/' % project.RelPath(local=opt.this_manifest_only)
324 return (1, output) 326 return (1, output)
325 327
326 if opt.verbose: 328 if opt.verbose:
@@ -344,7 +346,7 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config):
344 if mirror: 346 if mirror:
345 project_header_path = project.name 347 project_header_path = project.name
346 else: 348 else:
347 project_header_path = project.relpath 349 project_header_path = project.RelPath(local=opt.this_manifest_only)
348 out.project('project %s/' % project_header_path) 350 out.project('project %s/' % project_header_path)
349 out.nl() 351 out.nl()
350 buf.write(output) 352 buf.write(output)