summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index cdbbfdf7..2ca4e163 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -40,6 +40,17 @@ current working directory.
40The optional -b argument can be used to select the manifest branch 40The optional -b argument can be used to select the manifest branch
41to checkout and use. If no branch is specified, master is assumed. 41to checkout and use. If no branch is specified, master is assumed.
42 42
43The optional -m argument can be used to specify an alternate manifest
44to be used. If no manifest is specified, the manifest default.xml
45will be used.
46
47The --reference option can be used to point to a directory that
48has the content of a --mirror sync. This will make the working
49directory use as much data as possible from the local reference
50directory when fetching from the server. This will make the sync
51go a lot faster by reducing data traffic on the network.
52
53
43Switching Manifest Branches 54Switching Manifest Branches
44--------------------------- 55---------------------------
45 56
@@ -76,7 +87,9 @@ to update the working directory files.
76 g.add_option('--mirror', 87 g.add_option('--mirror',
77 dest='mirror', action='store_true', 88 dest='mirror', action='store_true',
78 help='mirror the forrest') 89 help='mirror the forrest')
79 90 g.add_option('--reference',
91 dest='reference',
92 help='location of mirror directory', metavar='DIR')
80 93
81 # Tool 94 # Tool
82 g = p.add_option_group('repo Version options') 95 g = p.add_option_group('repo Version options')
@@ -132,6 +145,9 @@ to update the working directory files.
132 r.ResetFetch() 145 r.ResetFetch()
133 r.Save() 146 r.Save()
134 147
148 if opt.reference:
149 m.config.SetString('repo.reference', opt.reference)
150
135 if opt.mirror: 151 if opt.mirror:
136 if is_new: 152 if is_new:
137 m.config.SetString('repo.mirror', 'true') 153 m.config.SetString('repo.mirror', 'true')
@@ -162,7 +178,11 @@ to update the working directory files.
162 syncbuf = SyncBuffer(m.config) 178 syncbuf = SyncBuffer(m.config)
163 m.Sync_LocalHalf(syncbuf) 179 m.Sync_LocalHalf(syncbuf)
164 syncbuf.Finish() 180 syncbuf.Finish()
181
182 if isinstance(self.manifest, XmlManifest):
183 self._LinkManifest(opt.manifest_name)
165 _ReloadManifest(self) 184 _ReloadManifest(self)
185
166 self._ApplyOptions(opt, is_new) 186 self._ApplyOptions(opt, is_new)
167 187
168 if not self.manifest.InitBranch(): 188 if not self.manifest.InitBranch():
@@ -200,8 +220,9 @@ to update the working directory files.
200 220
201 print '' 221 print ''
202 print 'Your identity is: %s <%s>' % (name, email) 222 print 'Your identity is: %s <%s>' % (name, email)
203 sys.stdout.write('is this correct [yes/no]? ') 223 sys.stdout.write('is this correct [y/n]? ')
204 if 'yes' == sys.stdin.readline().strip(): 224 a = sys.stdin.readline().strip()
225 if a in ('yes', 'y', 't', 'true'):
205 break 226 break
206 227
207 if name != mp.UserName: 228 if name != mp.UserName:
@@ -249,8 +270,6 @@ to update the working directory files.
249 def Execute(self, opt, args): 270 def Execute(self, opt, args):
250 git_require(MIN_GIT_VERSION, fail=True) 271 git_require(MIN_GIT_VERSION, fail=True)
251 self._SyncManifest(opt) 272 self._SyncManifest(opt)
252 if isinstance(self.manifest, XmlManifest):
253 self._LinkManifest(opt.manifest_name)
254 273
255 if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: 274 if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
256 self._ConfigureUser() 275 self._ConfigureUser()