From b240d28bc065b94ea91383f58e7d55494d2691c1 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Tue, 8 Nov 2022 23:10:27 +0000 Subject: [PATCH] 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 Tested-by: LaMont Jones --- subcmds/upload.py | 12 +++++++----- 1 file 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/ script = [] script.append('# Uncomment the branches to upload:') for project, avail in pending: + project_path = project.RelPath(local=opt.this_manifest_only) script.append('#') - script.append('# project %s/:' % project.RelPath(local=opt.this_manifest_only)) + script.append(f'# project {project_path}/:') b = {} for branch in avail: @@ -302,8 +303,8 @@ Gerrit Code Review: https://www.gerritcodereview.com/ script.append('# %s' % commit) b[name] = branch - projects[project.RelPath(local=opt.this_manifest_only)] = project - branches[project.name] = b + projects[project_path] = project + branches[project_path] = b script.append('') script = Editor.EditString("\n".join(script)).split("\n") @@ -328,9 +329,10 @@ Gerrit Code Review: https://www.gerritcodereview.com/ name = m.group(1) if not project: _die('project for branch %s not in script', name) - branch = branches[project.name].get(name) + project_path = project.RelPath(local=opt.this_manifest_only) + branch = branches[project_path].get(name) if not branch: - _die('branch %s not in %s', name, project.RelPath(local=opt.this_manifest_only)) + _die('branch %s not in %s', name, project_path) todo.append(branch) if not todo: _die("nothing uncommented for upload")