diff options
author | Shawn O. Pearce <sop@google.com> | 2009-07-03 16:24:57 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-07-03 20:03:38 -0700 |
commit | 75b87c8a5171b26947d0a13d970f09defac736e3 (patch) | |
tree | b8d3eb561b8faa2d3fc73e04d402128fdca1b8b3 | |
parent | abb7a3dfecdfe98b30594219f24c5c3d5e11e990 (diff) | |
download | git-repo-75b87c8a5171b26947d0a13d970f09defac736e3.tar.gz |
Abstract manifest branch creation from init to the manifest object
This permits the XML style manifest to use 'default', while other
types can use their own creation strategy for the current branch.
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | manifest.py | 3 | ||||
-rw-r--r-- | manifest_xml.py | 6 | ||||
-rw-r--r-- | subcmds/init.py | 7 |
3 files changed, 12 insertions, 4 deletions
diff --git a/manifest.py b/manifest.py index 0762098b..a2fc9601 100644 --- a/manifest.py +++ b/manifest.py | |||
@@ -40,5 +40,8 @@ class Manifest(object): | |||
40 | def projects(self): | 40 | def projects(self): |
41 | return {} | 41 | return {} |
42 | 42 | ||
43 | def InitBranch(self): | ||
44 | pass | ||
45 | |||
43 | def SetMRefs(self, project): | 46 | def SetMRefs(self, project): |
44 | pass | 47 | pass |
diff --git a/manifest_xml.py b/manifest_xml.py index 66cdf3e3..45896be9 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -169,6 +169,12 @@ class XmlManifest(Manifest): | |||
169 | self._Load() | 169 | self._Load() |
170 | return self._default | 170 | return self._default |
171 | 171 | ||
172 | def InitBranch(self): | ||
173 | m = self.manifestProject | ||
174 | if m.CurrentBranch is None: | ||
175 | return m.StartBranch('default') | ||
176 | return True | ||
177 | |||
172 | def SetMRefs(self, project): | 178 | def SetMRefs(self, project): |
173 | if self.branch: | 179 | if self.branch: |
174 | project._InitAnyMRef(R_M + self.branch) | 180 | project._InitAnyMRef(R_M + self.branch) |
diff --git a/subcmds/init.py b/subcmds/init.py index ec87d036..0075b0b4 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -130,10 +130,9 @@ to update the working directory files. | |||
130 | m.Sync_LocalHalf(syncbuf) | 130 | m.Sync_LocalHalf(syncbuf) |
131 | syncbuf.Finish() | 131 | syncbuf.Finish() |
132 | 132 | ||
133 | if is_new or m.CurrentBranch is None: | 133 | if not self.manifest.InitBranch(): |
134 | if not m.StartBranch('default'): | 134 | print >>sys.stderr, 'fatal: cannot create branch in manifest' |
135 | print >>sys.stderr, 'fatal: cannot create default in manifest' | 135 | sys.exit(1) |
136 | sys.exit(1) | ||
137 | 136 | ||
138 | def _LinkManifest(self, name): | 137 | def _LinkManifest(self, name): |
139 | if not name: | 138 | if not name: |