summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--project.py16
-rw-r--r--subcmds/init.py3
2 files changed, 19 insertions, 0 deletions
diff --git a/project.py b/project.py
index 4f0345f8..d336f990 100644
--- a/project.py
+++ b/project.py
@@ -2167,6 +2167,22 @@ class MetaProject(Project):
2167 self.revisionExpr = base 2167 self.revisionExpr = base
2168 self.revisionId = None 2168 self.revisionId = None
2169 2169
2170 def MetaBranchSwitch(self, target):
2171 """ Prepare MetaProject for manifest branch switch
2172 """
2173
2174 # detach and delete manifest branch, allowing a new
2175 # branch to take over
2176 syncbuf = SyncBuffer(self.config, detach_head = True)
2177 self.Sync_LocalHalf(syncbuf)
2178 syncbuf.Finish()
2179
2180 return GitCommand(self,
2181 ['branch', '-D', 'default'],
2182 capture_stdout = True,
2183 capture_stderr = True).Wait() == 0
2184
2185
2170 @property 2186 @property
2171 def LastFetch(self): 2187 def LastFetch(self):
2172 try: 2188 try:
diff --git a/subcmds/init.py b/subcmds/init.py
index b359024d..a758fbb1 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -187,6 +187,9 @@ to update the working directory files.
187 shutil.rmtree(m.gitdir) 187 shutil.rmtree(m.gitdir)
188 sys.exit(1) 188 sys.exit(1)
189 189
190 if opt.manifest_branch:
191 m.MetaBranchSwitch(opt.manifest_branch)
192
190 syncbuf = SyncBuffer(m.config) 193 syncbuf = SyncBuffer(m.config)
191 m.Sync_LocalHalf(syncbuf) 194 m.Sync_LocalHalf(syncbuf)
192 syncbuf.Finish() 195 syncbuf.Finish()