diff options
author | Dan Willemsen <dwillemsen@google.com> | 2016-04-06 16:03:54 -0700 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-04-22 10:32:06 +0900 |
commit | 96c2d654897ffe82d7df9f1dd2295cda5809be73 (patch) | |
tree | 50f12eb584bb4ea64e4c43757ace386678c1f9c9 /manifest_xml.py | |
parent | cee5c771664833e517f47c0a33e520fd967cbe57 (diff) | |
download | git-repo-96c2d654897ffe82d7df9f1dd2295cda5809be73.tar.gz |
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
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 3ac607ec..bc4d8c40 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -102,7 +102,10 @@ class _XmlRemote(object): | |||
102 | remoteName = self.name | 102 | remoteName = self.name |
103 | if self.remoteAlias: | 103 | if self.remoteAlias: |
104 | remoteName = self.remoteAlias | 104 | remoteName = self.remoteAlias |
105 | return RemoteSpec(remoteName, url, self.reviewUrl) | 105 | return RemoteSpec(remoteName, |
106 | url=url, | ||
107 | review=self.reviewUrl, | ||
108 | orig_name=self.name) | ||
106 | 109 | ||
107 | class XmlManifest(object): | 110 | class XmlManifest(object): |
108 | """manages the repo configuration file""" | 111 | """manages the repo configuration file""" |
@@ -249,9 +252,9 @@ class XmlManifest(object): | |||
249 | e.setAttribute('path', relpath) | 252 | e.setAttribute('path', relpath) |
250 | remoteName = None | 253 | remoteName = None |
251 | if d.remote: | 254 | if d.remote: |
252 | remoteName = d.remote.remoteAlias or d.remote.name | 255 | remoteName = d.remote.name |
253 | if not d.remote or p.remote.name != remoteName: | 256 | if not d.remote or p.remote.orig_name != remoteName: |
254 | remoteName = p.remote.name | 257 | remoteName = p.remote.orig_name |
255 | e.setAttribute('remote', remoteName) | 258 | e.setAttribute('remote', remoteName) |
256 | if peg_rev: | 259 | if peg_rev: |
257 | if self.IsMirror: | 260 | if self.IsMirror: |
@@ -267,7 +270,7 @@ class XmlManifest(object): | |||
267 | # isn't our value | 270 | # isn't our value |
268 | e.setAttribute('upstream', p.revisionExpr) | 271 | e.setAttribute('upstream', p.revisionExpr) |
269 | else: | 272 | else: |
270 | revision = self.remotes[remoteName].revision or d.revisionExpr | 273 | revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr |
271 | if not revision or revision != p.revisionExpr: | 274 | if not revision or revision != p.revisionExpr: |
272 | e.setAttribute('revision', p.revisionExpr) | 275 | e.setAttribute('revision', p.revisionExpr) |
273 | if p.upstream and p.upstream != p.revisionExpr: | 276 | if p.upstream and p.upstream != p.revisionExpr: |