Просмотр исходного кода

Respect remote aliases

Previously, change I7150e449341ed8655d398956a095261978d95870
had broken alias support in order to fix the manifest command to keep
it from spitting projects that point to an alias that wasn't recorded.
This commit reverts that commit and instead solves the issue more
correctly, outputting the alias in the remote node of the manifest and
respecting that alias when outputting the list of projects.

Change-Id: I941fc4adb7121d2e61cedc5838e80d3918c977c3
Conley Owens 12 лет назад
Родитель
Сommit
1e7ab2a63f
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      manifest_xml.py

+ 6 - 1
manifest_xml.py

@@ -91,6 +91,8 @@ class _XmlRemote(object):
   def ToRemoteSpec(self, projectName):
   def ToRemoteSpec(self, projectName):
     url = self.resolvedFetchUrl.rstrip('/') + '/' + projectName
     url = self.resolvedFetchUrl.rstrip('/') + '/' + projectName
     remoteName = self.name
     remoteName = self.name
+    if self.remoteAlias:
+        remoteName = self.remoteAlias
     return RemoteSpec(remoteName, url, self.reviewUrl)
     return RemoteSpec(remoteName, url, self.reviewUrl)
 
 
 class XmlManifest(object):
 class XmlManifest(object):
@@ -145,6 +147,8 @@ class XmlManifest(object):
     root.appendChild(e)
     root.appendChild(e)
     e.setAttribute('name', r.name)
     e.setAttribute('name', r.name)
     e.setAttribute('fetch', r.fetchUrl)
     e.setAttribute('fetch', r.fetchUrl)
+    if r.remoteAlias is not None:
+      e.setAttribute('alias', r.remoteAlias)
     if r.reviewUrl is not None:
     if r.reviewUrl is not None:
       e.setAttribute('review', r.reviewUrl)
       e.setAttribute('review', r.reviewUrl)
 
 
@@ -223,7 +227,8 @@ class XmlManifest(object):
       e.setAttribute('name', name)
       e.setAttribute('name', name)
       if relpath != name:
       if relpath != name:
         e.setAttribute('path', relpath)
         e.setAttribute('path', relpath)
-      if not d.remote or p.remote.name != d.remote.name:
+      remoteName = d.remote.remoteAlias or d.remote.name
+      if not d.remote or p.remote.name != remoteName:
         e.setAttribute('remote', p.remote.name)
         e.setAttribute('remote', p.remote.name)
       if peg_rev:
       if peg_rev:
         if self.IsMirror:
         if self.IsMirror: