summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-07-03 15:29:02 -0700
committerShawn O. Pearce <sop@google.com>2009-07-03 20:03:38 -0700
commitcc6c79643e1cafad565424caabe581e7b548bf6f (patch)
tree29fe305852e0488f54548e1d2a9d3e39f8d39f85
parent2095179beec754d2d5bfe175215e736b7ff838e9 (diff)
downloadgit-repo-cc6c79643e1cafad565424caabe581e7b548bf6f.tar.gz
Make refs/remotes/m management the manifest object's responsibility
I plan to have the new submodule manifest format use a different layout for the m refs than the XML manifest format has used in the past. Thus we need to move the behavior management into the manifest object, and out of the project, so we can change it. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--git_refs.py1
-rw-r--r--manifest.py7
-rw-r--r--manifest_xml.py5
-rw-r--r--project.py8
4 files changed, 14 insertions, 7 deletions
diff --git a/git_refs.py b/git_refs.py
index ac8ed0c1..b24a0b4e 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -21,7 +21,6 @@ HEAD = 'HEAD'
21R_HEADS = 'refs/heads/' 21R_HEADS = 'refs/heads/'
22R_TAGS = 'refs/tags/' 22R_TAGS = 'refs/tags/'
23R_PUB = 'refs/published/' 23R_PUB = 'refs/published/'
24R_M = 'refs/remotes/m/'
25 24
26 25
27class GitRefs(object): 26class GitRefs(object):
diff --git a/manifest.py b/manifest.py
index bf801dfa..0762098b 100644
--- a/manifest.py
+++ b/manifest.py
@@ -35,3 +35,10 @@ class Manifest(object):
35 @property 35 @property
36 def IsMirror(self): 36 def IsMirror(self):
37 return self.manifestProject.config.GetBoolean('repo.mirror') 37 return self.manifestProject.config.GetBoolean('repo.mirror')
38
39 @property
40 def projects(self):
41 return {}
42
43 def SetMRefs(self, project):
44 pass
diff --git a/manifest_xml.py b/manifest_xml.py
index 97df75bd..66cdf3e3 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -29,6 +29,7 @@ from error import ManifestParseError
29 29
30MANIFEST_FILE_NAME = 'manifest.xml' 30MANIFEST_FILE_NAME = 'manifest.xml'
31LOCAL_MANIFEST_NAME = 'local_manifest.xml' 31LOCAL_MANIFEST_NAME = 'local_manifest.xml'
32R_M = 'refs/remotes/m/'
32 33
33class _Default(object): 34class _Default(object):
34 """Project defaults within the manifest.""" 35 """Project defaults within the manifest."""
@@ -168,6 +169,10 @@ class XmlManifest(Manifest):
168 self._Load() 169 self._Load()
169 return self._default 170 return self._default
170 171
172 def SetMRefs(self, project):
173 if self.branch:
174 project._InitAnyMRef(R_M + self.branch)
175
171 def _Unload(self): 176 def _Unload(self):
172 self._loaded = False 177 self._loaded = False
173 self._projects = {} 178 self._projects = {}
diff --git a/project.py b/project.py
index bedc91ee..6188ca72 100644
--- a/project.py
+++ b/project.py
@@ -27,7 +27,7 @@ from git_config import GitConfig, IsId
27from error import GitError, ImportError, UploadError 27from error import GitError, ImportError, UploadError
28from error import ManifestInvalidRevisionError 28from error import ManifestInvalidRevisionError
29 29
30from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M 30from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB
31 31
32def _lwrite(path, content): 32def _lwrite(path, content):
33 lock = '%s.lock' % path 33 lock = '%s.lock' % path
@@ -598,7 +598,7 @@ class Project(object):
598 return False 598 return False
599 599
600 if self.worktree: 600 if self.worktree:
601 self._InitMRef() 601 self.manifest.SetMRefs(self)
602 else: 602 else:
603 self._InitMirrorHead() 603 self._InitMirrorHead()
604 try: 604 try:
@@ -1080,10 +1080,6 @@ class Project(object):
1080 remote.ResetFetch(mirror=True) 1080 remote.ResetFetch(mirror=True)
1081 remote.Save() 1081 remote.Save()
1082 1082
1083 def _InitMRef(self):
1084 if self.manifest.branch:
1085 self._InitAnyMRef(R_M + self.manifest.branch)
1086
1087 def _InitMirrorHead(self): 1083 def _InitMirrorHead(self):
1088 self._InitAnyMRef(HEAD) 1084 self._InitAnyMRef(HEAD)
1089 1085