Allow for reusing the `main`/`master` branch.

Bug: 1416631
Change-Id: I498e54e46c4ce97cb5f7f43f1f484640e74ada44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4300529
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
changes/29/4300529/4
Joanna Wang 2 years ago committed by LUCI CQ
parent d75fc885fd
commit 74c53b6222

@ -4846,8 +4846,13 @@ def UploadAllSquashed(options, orig_args):
origin, upstream_branch_ref = Changelist.FetchUpstreamTuple(branch)
if origin == '.':
upstream_branch = scm.GIT.ShortBranchName(upstream_branch_ref)
parent = scm.GIT.GetBranchConfig(settings.GetRoot(), upstream_branch,
GERRIT_SQUASH_HASH_CONFIG_KEY)
# Support the `git merge` and `git pull` workflow.
if upstream_branch in ['master', 'main']:
parent = cl.GetCommonAncestorWithUpstream()
else:
parent = scm.GIT.GetBranchConfig(settings.GetRoot(), upstream_branch,
GERRIT_SQUASH_HASH_CONFIG_KEY)
if parent:
break
branch = upstream_branch

Loading…
Cancel
Save