Merge "Fix XmlManifest.Save with remotes that have 'alias' set"

This commit is contained in:
Dan Willemsen 2016-04-22 18:28:55 +00:00 committed by Gerrit Code Review
commit 8b39fb4bc0
2 changed files with 11 additions and 6 deletions

View File

@ -102,7 +102,10 @@ class _XmlRemote(object):
remoteName = self.name remoteName = self.name
if self.remoteAlias: if self.remoteAlias:
remoteName = 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): class XmlManifest(object):
"""manages the repo configuration file""" """manages the repo configuration file"""
@ -249,9 +252,9 @@ class XmlManifest(object):
e.setAttribute('path', relpath) e.setAttribute('path', relpath)
remoteName = None remoteName = None
if d.remote: if d.remote:
remoteName = d.remote.remoteAlias or d.remote.name remoteName = d.remote.name
if not d.remote or p.remote.name != remoteName: if not d.remote or p.remote.orig_name != remoteName:
remoteName = p.remote.name remoteName = p.remote.orig_name
e.setAttribute('remote', remoteName) e.setAttribute('remote', remoteName)
if peg_rev: if peg_rev:
if self.IsMirror: if self.IsMirror:
@ -267,7 +270,7 @@ class XmlManifest(object):
# isn't our value # isn't our value
e.setAttribute('upstream', p.revisionExpr) e.setAttribute('upstream', p.revisionExpr)
else: 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: if not revision or revision != p.revisionExpr:
e.setAttribute('revision', p.revisionExpr) e.setAttribute('revision', p.revisionExpr)
if p.upstream and p.upstream != p.revisionExpr: if p.upstream and p.upstream != p.revisionExpr:

View File

@ -315,11 +315,13 @@ class RemoteSpec(object):
name, name,
url=None, url=None,
review=None, review=None,
revision=None): revision=None,
orig_name=None):
self.name = name self.name = name
self.url = url self.url = url
self.review = review self.review = review
self.revision = revision self.revision = revision
self.orig_name = orig_name
class RepoHook(object): class RepoHook(object):