summaryrefslogtreecommitdiffstats
path: root/subcmds/diff.py
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-06-22 19:21:15 +0000
committerLaMont Jones <lamontjones@google.com>2022-07-14 16:00:18 +0000
commit8501d4602a4c85f1e22c7a51ad191af8166efecd (patch)
treee8c5bf46c22f029412b35fc48c04daed73cde633 /subcmds/diff.py
parent8db78c7d4db84ff9e191457bbf4b1254da321c7e (diff)
downloadgit-repo-8501d4602a4c85f1e22c7a51ad191af8166efecd.tar.gz
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>
Diffstat (limited to 'subcmds/diff.py')
-rw-r--r--subcmds/diff.py9
1 files changed, 6 insertions, 3 deletions
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.
35 dest='absolute', action='store_true', 35 dest='absolute', action='store_true',
36 help='paths are relative to the repository root') 36 help='paths are relative to the repository root')
37 37
38 def _ExecuteOne(self, absolute, project): 38 def _ExecuteOne(self, absolute, local, project):
39 """Obtains the diff for a specific project. 39 """Obtains the diff for a specific project.
40 40
41 Args: 41 Args:
42 absolute: Paths are relative to the root. 42 absolute: Paths are relative to the root.
43 local: a boolean, if True, the path is relative to the local
44 (sub)manifest. If false, the path is relative to the
45 outermost manifest.
43 project: Project to get status of. 46 project: Project to get status of.
44 47
45 Returns: 48 Returns:
46 The status of the project. 49 The status of the project.
47 """ 50 """
48 buf = io.StringIO() 51 buf = io.StringIO()
49 ret = project.PrintWorkTreeDiff(absolute, output_redir=buf) 52 ret = project.PrintWorkTreeDiff(absolute, output_redir=buf, local=local)
50 return (ret, buf.getvalue()) 53 return (ret, buf.getvalue())
51 54
52 def Execute(self, opt, args): 55 def Execute(self, opt, args):
@@ -63,7 +66,7 @@ to the Unix 'patch' command.
63 66
64 return self.ExecuteInParallel( 67 return self.ExecuteInParallel(
65 opt.jobs, 68 opt.jobs,
66 functools.partial(self._ExecuteOne, opt.absolute), 69 functools.partial(self._ExecuteOne, opt.absolute, opt.this_manifest_only),
67 all_projects, 70 all_projects,
68 callback=_ProcessResults, 71 callback=_ProcessResults,
69 ordered=True) 72 ordered=True)