mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Update revisionId if required when using extend-project
When a hard revision ID is provided in a regular project tag then the revisionId is updated as well if it is a commit hash. The difference is that if the revisionExpr is a commit, git-repo needs to update refs/remotes/m/master with update-ref not symbolic-ref, as the latter must refer to another ref, not to a specific commit. Change-Id: I215a62dabb30225e480ad2c731416d775fc0c750 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310963 Tested-by: Michael Kelly <mkelly@arista.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
37c21c268b
commit
2f3c3316e4
@ -887,13 +887,11 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
|
|||||||
if groups:
|
if groups:
|
||||||
p.groups.extend(groups)
|
p.groups.extend(groups)
|
||||||
if revision:
|
if revision:
|
||||||
p.revisionExpr = revision
|
p.SetRevision(revision)
|
||||||
if IsId(revision):
|
|
||||||
p.revisionId = revision
|
|
||||||
else:
|
|
||||||
p.revisionId = None
|
|
||||||
if remote:
|
if remote:
|
||||||
p.remote = remote.ToRemoteSpec(name)
|
p.remote = remote.ToRemoteSpec(name)
|
||||||
|
|
||||||
if dest_path:
|
if dest_path:
|
||||||
del self._paths[p.relpath]
|
del self._paths[p.relpath]
|
||||||
relpath, worktree, gitdir, objdir, _ = self.GetProjectPaths(name, dest_path)
|
relpath, worktree, gitdir, objdir, _ = self.GetProjectPaths(name, dest_path)
|
||||||
|
17
project.py
17
project.py
@ -520,14 +520,7 @@ class Project(object):
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.remote = remote
|
self.remote = remote
|
||||||
self.UpdatePaths(relpath, worktree, gitdir, objdir)
|
self.UpdatePaths(relpath, worktree, gitdir, objdir)
|
||||||
self.revisionExpr = revisionExpr
|
self.SetRevision(revisionExpr, revisionId=revisionId)
|
||||||
|
|
||||||
if revisionId is None \
|
|
||||||
and revisionExpr \
|
|
||||||
and IsId(revisionExpr):
|
|
||||||
self.revisionId = revisionExpr
|
|
||||||
else:
|
|
||||||
self.revisionId = revisionId
|
|
||||||
|
|
||||||
self.rebase = rebase
|
self.rebase = rebase
|
||||||
self.groups = groups
|
self.groups = groups
|
||||||
@ -557,6 +550,14 @@ class Project(object):
|
|||||||
# project containing repo hooks.
|
# project containing repo hooks.
|
||||||
self.enabled_repo_hooks = []
|
self.enabled_repo_hooks = []
|
||||||
|
|
||||||
|
def SetRevision(self, revisionExpr, revisionId=None):
|
||||||
|
"""Set revisionId based on revision expression and id"""
|
||||||
|
self.revisionExpr = revisionExpr
|
||||||
|
if revisionId is None and revisionExpr and IsId(revisionExpr):
|
||||||
|
self.revisionId = self.revisionExpr
|
||||||
|
else:
|
||||||
|
self.revisionId = revisionId
|
||||||
|
|
||||||
def UpdatePaths(self, relpath, worktree, gitdir, objdir):
|
def UpdatePaths(self, relpath, worktree, gitdir, objdir):
|
||||||
"""Update paths used by this project"""
|
"""Update paths used by this project"""
|
||||||
self.gitdir = gitdir.replace('\\', '/')
|
self.gitdir = gitdir.replace('\\', '/')
|
||||||
|
Loading…
Reference in New Issue
Block a user