summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-09-30 17:46:52 +0000
committerLaMont Jones <lamontjones@google.com>2022-11-15 21:13:06 +0000
commitbee4efb8742b90db543378be97247a22773c55f1 (patch)
tree78978a97939831f3d9241266f07f1e10aeca4319
parentf8af33c9f0ef38fbe9bd6944255738edc8d4e8c7 (diff)
downloadgit-repo-bee4efb8742b90db543378be97247a22773c55f1.tar.gz
subcmds: display correct path multitree messages
Correct usage of project.relpath for multi manifest workspaces. Change-Id: Idc32873552fcdae6eec7b03dde2b2f31134b72fd Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/347534 Reviewed-by: Xin Li <delphij@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
-rw-r--r--subcmds/branches.py6
-rw-r--r--subcmds/diffmanifests.py30
-rw-r--r--subcmds/sync.py2
3 files changed, 21 insertions, 17 deletions
diff --git a/subcmds/branches.py b/subcmds/branches.py
index b89cc2f8..fcf67ef5 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -155,11 +155,11 @@ is shown, then the branch appears in all projects.
155 if i.IsSplitCurrent or (in_cnt <= project_cnt - in_cnt): 155 if i.IsSplitCurrent or (in_cnt <= project_cnt - in_cnt):
156 in_type = 'in' 156 in_type = 'in'
157 for b in i.projects: 157 for b in i.projects:
158 relpath = b.project.relpath 158 relpath = _RelPath(b.project)
159 if not i.IsSplitCurrent or b.current: 159 if not i.IsSplitCurrent or b.current:
160 paths.append(_RelPath(b.project)) 160 paths.append(relpath)
161 else: 161 else:
162 non_cur_paths.append(_RelPath(b.project)) 162 non_cur_paths.append(relpath)
163 else: 163 else:
164 fmt = out.notinproject 164 fmt = out.notinproject
165 in_type = 'not in' 165 in_type = 'not in'
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py
index 08196ef9..4f9f5b0f 100644
--- a/subcmds/diffmanifests.py
+++ b/subcmds/diffmanifests.py
@@ -77,33 +77,35 @@ synced and their revisions won't be found.
77 metavar='<FORMAT>', 77 metavar='<FORMAT>',
78 help='print the log using a custom git pretty format string') 78 help='print the log using a custom git pretty format string')
79 79
80 def _printRawDiff(self, diff, pretty_format=None): 80 def _printRawDiff(self, diff, pretty_format=None, local=False):
81 _RelPath = lambda p: p.RelPath(local=local)
81 for project in diff['added']: 82 for project in diff['added']:
82 self.printText("A %s %s" % (project.relpath, project.revisionExpr)) 83 self.printText("A %s %s" % (_RelPath(project), project.revisionExpr))
83 self.out.nl() 84 self.out.nl()
84 85
85 for project in diff['removed']: 86 for project in diff['removed']:
86 self.printText("R %s %s" % (project.relpath, project.revisionExpr)) 87 self.printText("R %s %s" % (_RelPath(project), project.revisionExpr))
87 self.out.nl() 88 self.out.nl()
88 89
89 for project, otherProject in diff['changed']: 90 for project, otherProject in diff['changed']:
90 self.printText("C %s %s %s" % (project.relpath, project.revisionExpr, 91 self.printText("C %s %s %s" % (_RelPath(project), project.revisionExpr,
91 otherProject.revisionExpr)) 92 otherProject.revisionExpr))
92 self.out.nl() 93 self.out.nl()
93 self._printLogs(project, otherProject, raw=True, color=False, pretty_format=pretty_format) 94 self._printLogs(project, otherProject, raw=True, color=False, pretty_format=pretty_format)
94 95
95 for project, otherProject in diff['unreachable']: 96 for project, otherProject in diff['unreachable']:
96 self.printText("U %s %s %s" % (project.relpath, project.revisionExpr, 97 self.printText("U %s %s %s" % (_RelPath(project), project.revisionExpr,
97 otherProject.revisionExpr)) 98 otherProject.revisionExpr))
98 self.out.nl() 99 self.out.nl()
99 100
100 def _printDiff(self, diff, color=True, pretty_format=None): 101 def _printDiff(self, diff, color=True, pretty_format=None, local=False):
102 _RelPath = lambda p: p.RelPath(local=local)
101 if diff['added']: 103 if diff['added']:
102 self.out.nl() 104 self.out.nl()
103 self.printText('added projects : \n') 105 self.printText('added projects : \n')
104 self.out.nl() 106 self.out.nl()
105 for project in diff['added']: 107 for project in diff['added']:
106 self.printProject('\t%s' % (project.relpath)) 108 self.printProject('\t%s' % (_RelPath(project)))
107 self.printText(' at revision ') 109 self.printText(' at revision ')
108 self.printRevision(project.revisionExpr) 110 self.printRevision(project.revisionExpr)
109 self.out.nl() 111 self.out.nl()
@@ -113,7 +115,7 @@ synced and their revisions won't be found.
113 self.printText('removed projects : \n') 115 self.printText('removed projects : \n')
114 self.out.nl() 116 self.out.nl()
115 for project in diff['removed']: 117 for project in diff['removed']:
116 self.printProject('\t%s' % (project.relpath)) 118 self.printProject('\t%s' % (_RelPath(project)))
117 self.printText(' at revision ') 119 self.printText(' at revision ')
118 self.printRevision(project.revisionExpr) 120 self.printRevision(project.revisionExpr)
119 self.out.nl() 121 self.out.nl()
@@ -123,7 +125,7 @@ synced and their revisions won't be found.
123 self.printText('missing projects : \n') 125 self.printText('missing projects : \n')
124 self.out.nl() 126 self.out.nl()
125 for project in diff['missing']: 127 for project in diff['missing']:
126 self.printProject('\t%s' % (project.relpath)) 128 self.printProject('\t%s' % (_RelPath(project)))
127 self.printText(' at revision ') 129 self.printText(' at revision ')
128 self.printRevision(project.revisionExpr) 130 self.printRevision(project.revisionExpr)
129 self.out.nl() 131 self.out.nl()
@@ -133,7 +135,7 @@ synced and their revisions won't be found.
133 self.printText('changed projects : \n') 135 self.printText('changed projects : \n')
134 self.out.nl() 136 self.out.nl()
135 for project, otherProject in diff['changed']: 137 for project, otherProject in diff['changed']:
136 self.printProject('\t%s' % (project.relpath)) 138 self.printProject('\t%s' % (_RelPath(project)))
137 self.printText(' changed from ') 139 self.printText(' changed from ')
138 self.printRevision(project.revisionExpr) 140 self.printRevision(project.revisionExpr)
139 self.printText(' to ') 141 self.printText(' to ')
@@ -148,7 +150,7 @@ synced and their revisions won't be found.
148 self.printText('projects with unreachable revisions : \n') 150 self.printText('projects with unreachable revisions : \n')
149 self.out.nl() 151 self.out.nl()
150 for project, otherProject in diff['unreachable']: 152 for project, otherProject in diff['unreachable']:
151 self.printProject('\t%s ' % (project.relpath)) 153 self.printProject('\t%s ' % (_RelPath(project)))
152 self.printRevision(project.revisionExpr) 154 self.printRevision(project.revisionExpr)
153 self.printText(' or ') 155 self.printText(' or ')
154 self.printRevision(otherProject.revisionExpr) 156 self.printRevision(otherProject.revisionExpr)
@@ -214,6 +216,8 @@ synced and their revisions won't be found.
214 216
215 diff = manifest1.projectsDiff(manifest2) 217 diff = manifest1.projectsDiff(manifest2)
216 if opt.raw: 218 if opt.raw:
217 self._printRawDiff(diff, pretty_format=opt.pretty_format) 219 self._printRawDiff(diff, pretty_format=opt.pretty_format,
220 local=opt.this_manifest_only)
218 else: 221 else:
219 self._printDiff(diff, color=opt.color, pretty_format=opt.pretty_format) 222 self._printDiff(diff, color=opt.color, pretty_format=opt.pretty_format,
223 local=opt.this_manifest_only)
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 862c7e2c..1ed37cef 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -723,7 +723,7 @@ later is required to fix a server side protocol bug.
723 # ...we'll let existing jobs finish, though. 723 # ...we'll let existing jobs finish, though.
724 if not success: 724 if not success:
725 ret = False 725 ret = False
726 err_results.append(project.relpath) 726 err_results.append(project.RelPath(local=opt.this_manifest_only))
727 if opt.fail_fast: 727 if opt.fail_fast:
728 if pool: 728 if pool:
729 pool.close() 729 pool.close()