From f9f4df62e062cccd279867c551a109365b4f380f Mon Sep 17 00:00:00 2001 From: joehsu Date: Wed, 2 Oct 2024 20:01:59 +0800 Subject: [PATCH] Use full name of the revision when checking dest-branch The manifest usually doesn't sepecify the revision with the full name (e.g. refs/heads/REV). However, when checking if the name of the merge branch, full name is used on the merge branch. The CL use full name of revision when comparing it with the merge branch. Bug: b/370919047 Test: repo upload on a project with `dest-branch` set Change-Id: Ib6fa2f7246beb5bae0a26a70048a7ac03b6c5a2f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/438401 Reviewed-by: Josip Sokcevic Tested-by: Joe Hsu Commit-Queue: Josip Sokcevic --- subcmds/upload.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subcmds/upload.py b/subcmds/upload.py index 6344ee31..9b77b0ee 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -603,19 +603,22 @@ Gerrit Code Review: https://www.gerritcodereview.com/ full_dest = destination if not full_dest.startswith(R_HEADS): full_dest = R_HEADS + full_dest + full_revision = branch.project.revisionExpr + if not full_revision.startswith(R_HEADS): + full_revision = R_HEADS + full_revision # If the merge branch of the local branch is different from # the project's revision AND destination, this might not be # intentional. if ( merge_branch - and merge_branch != branch.project.revisionExpr + and merge_branch != full_revision and merge_branch != full_dest ): print( f"For local branch {branch.name}: merge branch " f"{merge_branch} does not match destination branch " - f"{destination}" + f"{destination} and revision {branch.project.revisionExpr}" ) print("skipping upload.") print(