summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-11-08 23:10:27 +0000
committerLaMont Jones <lamontjones@google.com>2022-11-14 21:58:10 +0000
commitb240d28bc065b94ea91383f58e7d55494d2691c1 (patch)
tree57b11296d628b617c14cfc21798de2e8590b74c0
parent47020ba249c39783a66c0031fd9200caecfbbdc8 (diff)
downloadgit-repo-b240d28bc065b94ea91383f58e7d55494d2691c1.tar.gz
upload: track projects by path, rather than name
Since the same project can be checked out in multiple paths, we need to track the "to be uploaded" projects by path, rather than project name. Bug: crbug.com/gerrit/16260 Test: manual Change-Id: Ic3dc81bb8acb34886baa6299e90a49c7ba372957 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/351054 Reviewed-by: Xin Li <delphij@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
-rw-r--r--subcmds/upload.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py
index d341458d..0ad3ce26 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -278,8 +278,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/
278 script = [] 278 script = []
279 script.append('# Uncomment the branches to upload:') 279 script.append('# Uncomment the branches to upload:')
280 for project, avail in pending: 280 for project, avail in pending:
281 project_path = project.RelPath(local=opt.this_manifest_only)
281 script.append('#') 282 script.append('#')
282 script.append('# project %s/:' % project.RelPath(local=opt.this_manifest_only)) 283 script.append(f'# project {project_path}/:')
283 284
284 b = {} 285 b = {}
285 for branch in avail: 286 for branch in avail:
@@ -302,8 +303,8 @@ Gerrit Code Review: https://www.gerritcodereview.com/
302 script.append('# %s' % commit) 303 script.append('# %s' % commit)
303 b[name] = branch 304 b[name] = branch
304 305
305 projects[project.RelPath(local=opt.this_manifest_only)] = project 306 projects[project_path] = project
306 branches[project.name] = b 307 branches[project_path] = b
307 script.append('') 308 script.append('')
308 309
309 script = Editor.EditString("\n".join(script)).split("\n") 310 script = Editor.EditString("\n".join(script)).split("\n")
@@ -328,9 +329,10 @@ Gerrit Code Review: https://www.gerritcodereview.com/
328 name = m.group(1) 329 name = m.group(1)
329 if not project: 330 if not project:
330 _die('project for branch %s not in script', name) 331 _die('project for branch %s not in script', name)
331 branch = branches[project.name].get(name) 332 project_path = project.RelPath(local=opt.this_manifest_only)
333 branch = branches[project_path].get(name)
332 if not branch: 334 if not branch:
333 _die('branch %s not in %s', name, project.RelPath(local=opt.this_manifest_only)) 335 _die('branch %s not in %s', name, project_path)
334 todo.append(branch) 336 todo.append(branch)
335 if not todo: 337 if not todo:
336 _die("nothing uncommented for upload") 338 _die("nothing uncommented for upload")