From cc879a97c3e2614d19b15b4661c3cab4d33139c9 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Thu, 18 Nov 2021 22:40:18 +0000 Subject: Add multi-manifest support with element 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 Reviewed-by: Mike Frysinger --- subcmds/forall.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'subcmds/forall.py') 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. def Execute(self, opt, args): cmd = [opt.command[0]] + all_trees = not opt.this_manifest_only shell = True if re.compile(r'^[a-z0-9A-Z_/\.-]+$').match(cmd[0]): @@ -213,11 +214,11 @@ without iterating through the remaining projects. self.manifest.Override(smart_sync_manifest_path) if opt.regex: - projects = self.FindProjects(args) + projects = self.FindProjects(args, all_manifests=all_trees) elif opt.inverse_regex: - projects = self.FindProjects(args, inverse=True) + projects = self.FindProjects(args, inverse=True, all_manifests=all_trees) else: - projects = self.GetProjects(args, groups=opt.groups) + projects = self.GetProjects(args, groups=opt.groups, all_manifests=all_trees) os.environ['REPO_COUNT'] = str(len(projects)) @@ -290,6 +291,7 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config): setenv('REPO_PROJECT', project.name) setenv('REPO_PATH', project.relpath) + setenv('REPO_OUTERPATH', project.RelPath(local=opt.this_manifest_only)) setenv('REPO_REMOTE', project.remote.name) try: # 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): output = '' if ((opt.project_header and opt.verbose) or not opt.project_header): - output = 'skipping %s/' % project.relpath + output = 'skipping %s/' % project.RelPath(local=opt.this_manifest_only) return (1, output) if opt.verbose: @@ -344,7 +346,7 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config): if mirror: project_header_path = project.name else: - project_header_path = project.relpath + project_header_path = project.RelPath(local=opt.this_manifest_only) out.project('project %s/' % project_header_path) out.nl() buf.write(output) -- cgit v1.2.3-54-g00ecf