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

Assume the manifest branch matches the branch name in Git

Whatever branch name we checked the manifest out from is the name
we want to reflect throughout the rest of the projects, e.g. within
the special "m/" remote space.

This reduces the difference between different branches within the
manifest file.

Signed-off-by: Shawn O. Pearce <sop@google.com>
Shawn O. Pearce 17 лет назад
Родитель
Сommit
2450a2987a
1 измененных файлов с 7 добавлено и 6 удалено
  1. 7 6
      manifest.py

+ 7 - 6
manifest.py

@@ -18,7 +18,7 @@ import sys
 import xml.dom.minidom
 import xml.dom.minidom
 
 
 from git_config import GitConfig, IsId
 from git_config import GitConfig, IsId
-from project import Project, MetaProject, R_TAGS
+from project import Project, MetaProject, R_HEADS
 from remote import Remote
 from remote import Remote
 from error import ManifestParseError
 from error import ManifestParseError
 
 
@@ -97,6 +97,12 @@ class Manifest(object):
 
 
   def _Load(self):
   def _Load(self):
     if not self._loaded:
     if not self._loaded:
+      m = self.manifestProject
+      b = m.GetBranch(m.CurrentBranch).merge
+      if b.startswith(R_HEADS):
+        b = b[len(R_HEADS):]
+      self.branch = b
+
       self._ParseManifest(True)
       self._ParseManifest(True)
 
 
       local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME)
       local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME)
@@ -123,11 +129,6 @@ class Manifest(object):
             "no <manifest> in %s" % \
             "no <manifest> in %s" % \
             self.manifestFile
             self.manifestFile
 
 
-    if is_root_file:
-      self.branch = config.getAttribute('branch')
-      if not self.branch:
-        self.branch = 'default'
-
     for node in config.childNodes:
     for node in config.childNodes:
       if node.nodeName == 'remote':
       if node.nodeName == 'remote':
         remote = self._ParseRemote(node)
         remote = self._ParseRemote(node)