diff options
author | Shawn O. Pearce <sop@google.com> | 2009-07-03 15:29:02 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-07-03 20:03:38 -0700 |
commit | cc6c79643e1cafad565424caabe581e7b548bf6f (patch) | |
tree | 29fe305852e0488f54548e1d2a9d3e39f8d39f85 | |
parent | 2095179beec754d2d5bfe175215e736b7ff838e9 (diff) | |
download | git-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.py | 1 | ||||
-rw-r--r-- | manifest.py | 7 | ||||
-rw-r--r-- | manifest_xml.py | 5 | ||||
-rw-r--r-- | project.py | 8 |
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' | |||
21 | R_HEADS = 'refs/heads/' | 21 | R_HEADS = 'refs/heads/' |
22 | R_TAGS = 'refs/tags/' | 22 | R_TAGS = 'refs/tags/' |
23 | R_PUB = 'refs/published/' | 23 | R_PUB = 'refs/published/' |
24 | R_M = 'refs/remotes/m/' | ||
25 | 24 | ||
26 | 25 | ||
27 | class GitRefs(object): | 26 | class 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 | ||
30 | MANIFEST_FILE_NAME = 'manifest.xml' | 30 | MANIFEST_FILE_NAME = 'manifest.xml' |
31 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' | 31 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' |
32 | R_M = 'refs/remotes/m/' | ||
32 | 33 | ||
33 | class _Default(object): | 34 | class _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 = {} |
@@ -27,7 +27,7 @@ from git_config import GitConfig, IsId | |||
27 | from error import GitError, ImportError, UploadError | 27 | from error import GitError, ImportError, UploadError |
28 | from error import ManifestInvalidRevisionError | 28 | from error import ManifestInvalidRevisionError |
29 | 29 | ||
30 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M | 30 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB |
31 | 31 | ||
32 | def _lwrite(path, content): | 32 | def _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 | ||