mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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
This commit is contained in:
parent
e43322625a
commit
9ead97bb51
@ -50,16 +50,24 @@ else:
|
|||||||
from git_command import GitCommand
|
from git_command import GitCommand
|
||||||
from git_command import ssh_sock
|
from git_command import ssh_sock
|
||||||
from git_command import terminate_ssh_clients
|
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}$')
|
ID_RE = re.compile(r'^[0-9a-f]{40}$')
|
||||||
|
|
||||||
REVIEW_CACHE = dict()
|
REVIEW_CACHE = dict()
|
||||||
|
|
||||||
|
def IsChange(rev):
|
||||||
|
return rev.startswith(R_CHANGES)
|
||||||
|
|
||||||
def IsId(rev):
|
def IsId(rev):
|
||||||
return ID_RE.match(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):
|
def _key(name):
|
||||||
parts = name.split('.')
|
parts = name.split('.')
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
|
11
git_refs.py
11
git_refs.py
@ -16,11 +16,12 @@
|
|||||||
import os
|
import os
|
||||||
from trace import Trace
|
from trace import Trace
|
||||||
|
|
||||||
HEAD = 'HEAD'
|
HEAD = 'HEAD'
|
||||||
R_HEADS = 'refs/heads/'
|
R_CHANGES = 'refs/changes/'
|
||||||
R_TAGS = 'refs/tags/'
|
R_HEADS = 'refs/heads/'
|
||||||
R_PUB = 'refs/published/'
|
R_TAGS = 'refs/tags/'
|
||||||
R_M = 'refs/remotes/m/'
|
R_PUB = 'refs/published/'
|
||||||
|
R_M = 'refs/remotes/m/'
|
||||||
|
|
||||||
|
|
||||||
class GitRefs(object):
|
class GitRefs(object):
|
||||||
|
@ -18,7 +18,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command
|
from command import Command
|
||||||
from git_config import IsId
|
from git_config import IsImmutable
|
||||||
from git_command import git
|
from git_command import git
|
||||||
import gitc_utils
|
import gitc_utils
|
||||||
from progress import Progress
|
from progress import Progress
|
||||||
@ -96,11 +96,11 @@ revision specified in the manifest.
|
|||||||
project.Sync_LocalHalf(sync_buf)
|
project.Sync_LocalHalf(sync_buf)
|
||||||
project.revisionId = gitc_project.old_revision
|
project.revisionId = gitc_project.old_revision
|
||||||
|
|
||||||
# If the current revision is a specific SHA1 then we can't push back
|
# If the current revision is immutable, such as a SHA1, a tag or
|
||||||
# to it; so substitute with dest_branch if defined, or with manifest
|
# a change, then we can't push back to it. Substitute with
|
||||||
# default revision instead.
|
# dest_branch, if defined; or with manifest default revision instead.
|
||||||
branch_merge = ''
|
branch_merge = ''
|
||||||
if IsId(project.revisionExpr):
|
if IsImmutable(project.revisionExpr):
|
||||||
if project.dest_branch:
|
if project.dest_branch:
|
||||||
branch_merge = project.dest_branch
|
branch_merge = project.dest_branch
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user