From 9ead97bb51f5b1ad1d0a45e0c5442f15e1e38fd7 Mon Sep 17 00:00:00 2001 From: Zac Livingston Date: Tue, 13 Jun 2017 08:29:04 -0600 Subject: When starting a branch, do not use a tag or change value for branch.merge When starting a branch, branch.merge is set to project revision unless the revision is a SHA1. In that case, branch.merge is set to dest_branch if defined or manifest default revision otherwise. This special handling allows repo upload to work when the project revision is a SHA1. Extend the special handling to also happen when the project revision is a tag value or a change value so that repo upload will work in those case as well. Change-Id: Iff81ece40e770cd02535e80dcb023564d42dcf47 --- git_config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'git_config.py') diff --git a/git_config.py b/git_config.py index e00f6be2..8c247394 100644 --- a/git_config.py +++ b/git_config.py @@ -50,16 +50,24 @@ else: from git_command import GitCommand from git_command import ssh_sock from git_command import terminate_ssh_clients +from git_refs import R_CHANGES, R_HEADS, R_TAGS -R_HEADS = 'refs/heads/' -R_TAGS = 'refs/tags/' ID_RE = re.compile(r'^[0-9a-f]{40}$') REVIEW_CACHE = dict() +def IsChange(rev): + return rev.startswith(R_CHANGES) + def IsId(rev): return ID_RE.match(rev) +def IsTag(rev): + return rev.startswith(R_TAGS) + +def IsImmutable(rev): + return IsChange(rev) or IsId(rev) or IsTag(rev) + def _key(name): parts = name.split('.') if len(parts) < 2: -- cgit v1.2.3-54-g00ecf