diff options
| author | Yang Zhenhui <zhenhui.yang@sonymobile.com> | 2012-10-23 15:41:54 +0800 |
|---|---|---|
| committer | Bruce Zu <bruce.zu@sonymobile.com> | 2012-10-26 15:40:17 +0800 |
| commit | 75cc3533801a012c1fe6676e76148416a70693ca (patch) | |
| tree | c31c72c68ad62b857d01ad67f9af3236c35182a0 | |
| parent | 57365c98cc227255f50ab3d71462204c804eb975 (diff) | |
| download | git-repo-75cc3533801a012c1fe6676e76148416a70693ca.tar.gz | |
Show user about not initializing repo in current directory
If the parent of current directory has an initialized repo,
for example, if the current directory is
'/home/users/harry/platform/ics', and there is an initialized repo
in harry's home directory '/home/users/harry/.repo', when user
run 'repo init' command, repo is always initialized to parent
directory in '/home/users/harry/.repo', but most of time user
intends to initialize repo in the current directory, this patch
tells user how to do it.
Change-Id: Id7a76fb18ec0af243432c29605140d60f3de85ca
| -rw-r--r-- | subcmds/init.py | 23 |
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) | ||
