mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-31 16:14:25 +00:00
Fix XmlManifest.Save with remotes that have 'alias' set
When the alias attribute is set for a remote, the RemoteSpec attached to a Project only contains the alias name used by git, not the original name used in the manifest. But that's not enough information to reconstruct the manifest, so save off the original manifest name as another RemoteSpec parameter, only used to write the manifest out. Bug: Issue 181 Bug: Issue 219 Change-Id: Id7417dfd6ce5572e4e5fe14f22924fdf088ca4f3
This commit is contained in:
parent
cee5c77166
commit
96c2d65489
@ -102,7 +102,10 @@ class _XmlRemote(object):
|
||||
remoteName = self.name
|
||||
if self.remoteAlias:
|
||||
remoteName = self.remoteAlias
|
||||
return RemoteSpec(remoteName, url, self.reviewUrl)
|
||||
return RemoteSpec(remoteName,
|
||||
url=url,
|
||||
review=self.reviewUrl,
|
||||
orig_name=self.name)
|
||||
|
||||
class XmlManifest(object):
|
||||
"""manages the repo configuration file"""
|
||||
@ -249,9 +252,9 @@ class XmlManifest(object):
|
||||
e.setAttribute('path', relpath)
|
||||
remoteName = None
|
||||
if d.remote:
|
||||
remoteName = d.remote.remoteAlias or d.remote.name
|
||||
if not d.remote or p.remote.name != remoteName:
|
||||
remoteName = p.remote.name
|
||||
remoteName = d.remote.name
|
||||
if not d.remote or p.remote.orig_name != remoteName:
|
||||
remoteName = p.remote.orig_name
|
||||
e.setAttribute('remote', remoteName)
|
||||
if peg_rev:
|
||||
if self.IsMirror:
|
||||
@ -267,7 +270,7 @@ class XmlManifest(object):
|
||||
# isn't our value
|
||||
e.setAttribute('upstream', p.revisionExpr)
|
||||
else:
|
||||
revision = self.remotes[remoteName].revision or d.revisionExpr
|
||||
revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr
|
||||
if not revision or revision != p.revisionExpr:
|
||||
e.setAttribute('revision', p.revisionExpr)
|
||||
if p.upstream and p.upstream != p.revisionExpr:
|
||||
|
@ -315,11 +315,13 @@ class RemoteSpec(object):
|
||||
name,
|
||||
url=None,
|
||||
review=None,
|
||||
revision=None):
|
||||
revision=None,
|
||||
orig_name=None):
|
||||
self.name = name
|
||||
self.url = url
|
||||
self.review = review
|
||||
self.revision = revision
|
||||
self.orig_name = orig_name
|
||||
|
||||
|
||||
class RepoHook(object):
|
||||
|
Loading…
Reference in New Issue
Block a user