status, diff: display correct path for multi-manifest
Display the project path relative to the outermost manifest by default,
and relative to the sub manifest only when --this-manifest-only is
specified.
For project-related diagnostic messages, use the outermost manifest for
messages.
Change-Id: I4537d7dd412a2c182e77d6720e95c1b0ef70eb0e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/340754
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
diff --git a/subcmds/diff.py b/subcmds/diff.py
index a1f4ba8..a606ee9 100644
--- a/subcmds/diff.py
+++ b/subcmds/diff.py
@@ -35,18 +35,21 @@
dest='absolute', action='store_true',
help='paths are relative to the repository root')
- def _ExecuteOne(self, absolute, project):
+ def _ExecuteOne(self, absolute, local, project):
"""Obtains the diff for a specific project.
Args:
absolute: Paths are relative to the root.
+ local: a boolean, if True, the path is relative to the local
+ (sub)manifest. If false, the path is relative to the
+ outermost manifest.
project: Project to get status of.
Returns:
The status of the project.
"""
buf = io.StringIO()
- ret = project.PrintWorkTreeDiff(absolute, output_redir=buf)
+ ret = project.PrintWorkTreeDiff(absolute, output_redir=buf, local=local)
return (ret, buf.getvalue())
def Execute(self, opt, args):
@@ -63,7 +66,7 @@
return self.ExecuteInParallel(
opt.jobs,
- functools.partial(self._ExecuteOne, opt.absolute),
+ functools.partial(self._ExecuteOne, opt.absolute, opt.this_manifest_only),
all_projects,
callback=_ProcessResults,
ordered=True)