From 8501d4602a4c85f1e22c7a51ad191af8166efecd Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Wed, 22 Jun 2022 19:21:15 +0000 Subject: 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 Tested-by: LaMont Jones --- subcmds/diff.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'subcmds/diff.py') diff --git a/subcmds/diff.py b/subcmds/diff.py index a1f4ba88..a606ee9a 100644 --- a/subcmds/diff.py +++ b/subcmds/diff.py @@ -35,18 +35,21 @@ to the Unix 'patch' command. 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 @@ to the Unix 'patch' command. 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) -- cgit v1.2.3-54-g00ecf