summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2012-10-26 09:52:15 -0700
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-10-26 09:52:16 -0700
commitbed45f940072e6383bf219bc315a65692e93d682 (patch)
tree8ecdc0ac0fa61221366b183a09a224731327d4d5
parent55e4d464a7f8cf366290ba2d3c8bdd8297d71d32 (diff)
parent75cc3533801a012c1fe6676e76148416a70693ca (diff)
downloadgit-repo-bed45f940072e6383bf219bc315a65692e93d682.tar.gz
Merge "Show user about not initializing repo in current directory"
-rw-r--r--subcmds/init.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index b6b98076..e56b9223 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -313,6 +313,21 @@ to update the working directory files.
313 # We store the depth in the main manifest project. 313 # We store the depth in the main manifest project.
314 self.manifest.manifestProject.config.SetString('repo.depth', depth) 314 self.manifest.manifestProject.config.SetString('repo.depth', depth)
315 315
316 def _DisplayResult(self):
317 if self.manifest.IsMirror:
318 init_type = 'mirror '
319 else:
320 init_type = ''
321
322 print ''
323 print 'repo %shas been initialized in %s' % (init_type, self.manifest.topdir)
324
325 current_dir = os.getcwd()
326 if current_dir != self.manifest.topdir:
327 print 'If this is not the directory in which you want to initialize repo, please run:'
328 print ' rm -r %s/.repo' % self.manifest.topdir
329 print 'and try again.'
330
316 def Execute(self, opt, args): 331 def Execute(self, opt, args):
317 git_require(MIN_GIT_VERSION, fail=True) 332 git_require(MIN_GIT_VERSION, fail=True)
318 333
@@ -329,10 +344,4 @@ to update the working directory files.
329 344
330 self._ConfigureDepth(opt) 345 self._ConfigureDepth(opt)
331 346
332 if self.manifest.IsMirror: 347 self._DisplayResult()
333 init_type = 'mirror '
334 else:
335 init_type = ''
336
337 print ''
338 print 'repo %sinitialized in %s' % (init_type, self.manifest.topdir)