diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/init.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 8a29321e..af5bc297 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -347,7 +347,7 @@ to update the working directory files. | |||
| 347 | return value | 347 | return value |
| 348 | return a | 348 | return a |
| 349 | 349 | ||
| 350 | def _ShouldConfigureUser(self): | 350 | def _ShouldConfigureUser(self, opt): |
| 351 | gc = self.manifest.globalConfig | 351 | gc = self.manifest.globalConfig |
| 352 | mp = self.manifest.manifestProject | 352 | mp = self.manifest.manifestProject |
| 353 | 353 | ||
| @@ -359,21 +359,24 @@ to update the working directory files. | |||
| 359 | mp.config.SetString('user.name', gc.GetString('user.name')) | 359 | mp.config.SetString('user.name', gc.GetString('user.name')) |
| 360 | mp.config.SetString('user.email', gc.GetString('user.email')) | 360 | mp.config.SetString('user.email', gc.GetString('user.email')) |
| 361 | 361 | ||
| 362 | print() | 362 | if not opt.quiet: |
| 363 | print('Your identity is: %s <%s>' % (mp.config.GetString('user.name'), | 363 | print() |
| 364 | mp.config.GetString('user.email'))) | 364 | print('Your identity is: %s <%s>' % (mp.config.GetString('user.name'), |
| 365 | print('If you want to change this, please re-run \'repo init\' with --config-name') | 365 | mp.config.GetString('user.email'))) |
| 366 | print("If you want to change this, please re-run 'repo init' with --config-name") | ||
| 366 | return False | 367 | return False |
| 367 | 368 | ||
| 368 | def _ConfigureUser(self): | 369 | def _ConfigureUser(self, opt): |
| 369 | mp = self.manifest.manifestProject | 370 | mp = self.manifest.manifestProject |
| 370 | 371 | ||
| 371 | while True: | 372 | while True: |
| 372 | print() | 373 | if not opt.quiet: |
| 374 | print() | ||
| 373 | name = self._Prompt('Your Name', mp.UserName) | 375 | name = self._Prompt('Your Name', mp.UserName) |
| 374 | email = self._Prompt('Your Email', mp.UserEmail) | 376 | email = self._Prompt('Your Email', mp.UserEmail) |
| 375 | 377 | ||
| 376 | print() | 378 | if not opt.quiet: |
| 379 | print() | ||
| 377 | print('Your identity is: %s <%s>' % (name, email)) | 380 | print('Your identity is: %s <%s>' % (name, email)) |
| 378 | print('is this correct [y/N]? ', end='') | 381 | print('is this correct [y/N]? ', end='') |
| 379 | # TODO: When we require Python 3, use flush=True w/print above. | 382 | # TODO: When we require Python 3, use flush=True w/print above. |
| @@ -445,15 +448,16 @@ to update the working directory files. | |||
| 445 | # We store the depth in the main manifest project. | 448 | # We store the depth in the main manifest project. |
| 446 | self.manifest.manifestProject.config.SetString('repo.depth', depth) | 449 | self.manifest.manifestProject.config.SetString('repo.depth', depth) |
| 447 | 450 | ||
| 448 | def _DisplayResult(self): | 451 | def _DisplayResult(self, opt): |
| 449 | if self.manifest.IsMirror: | 452 | if self.manifest.IsMirror: |
| 450 | init_type = 'mirror ' | 453 | init_type = 'mirror ' |
| 451 | else: | 454 | else: |
| 452 | init_type = '' | 455 | init_type = '' |
| 453 | 456 | ||
| 454 | print() | 457 | if not opt.quiet: |
| 455 | print('repo %shas been initialized in %s' | 458 | print() |
| 456 | % (init_type, self.manifest.topdir)) | 459 | print('repo %shas been initialized in %s' % |
| 460 | (init_type, self.manifest.topdir)) | ||
| 457 | 461 | ||
| 458 | current_dir = os.getcwd() | 462 | current_dir = os.getcwd() |
| 459 | if current_dir != self.manifest.topdir: | 463 | if current_dir != self.manifest.topdir: |
| @@ -487,8 +491,8 @@ to update the working directory files. | |||
| 487 | self._LinkManifest(opt.manifest_name) | 491 | self._LinkManifest(opt.manifest_name) |
| 488 | 492 | ||
| 489 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: | 493 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: |
| 490 | if opt.config_name or self._ShouldConfigureUser(): | 494 | if opt.config_name or self._ShouldConfigureUser(opt): |
| 491 | self._ConfigureUser() | 495 | self._ConfigureUser(opt) |
| 492 | self._ConfigureColor() | 496 | self._ConfigureColor() |
| 493 | 497 | ||
| 494 | self._DisplayResult() | 498 | self._DisplayResult(opt) |
