mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
init: hide summary output when using --quiet
Change-Id: I5e30a6d6a1c95fb8d75d8b0f4d63b497e9aac526 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256452 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
75264789c0
commit
0b888912cb
@ -347,7 +347,7 @@ to update the working directory files.
|
|||||||
return value
|
return value
|
||||||
return a
|
return a
|
||||||
|
|
||||||
def _ShouldConfigureUser(self):
|
def _ShouldConfigureUser(self, opt):
|
||||||
gc = self.manifest.globalConfig
|
gc = self.manifest.globalConfig
|
||||||
mp = self.manifest.manifestProject
|
mp = self.manifest.manifestProject
|
||||||
|
|
||||||
@ -359,21 +359,24 @@ to update the working directory files.
|
|||||||
mp.config.SetString('user.name', gc.GetString('user.name'))
|
mp.config.SetString('user.name', gc.GetString('user.name'))
|
||||||
mp.config.SetString('user.email', gc.GetString('user.email'))
|
mp.config.SetString('user.email', gc.GetString('user.email'))
|
||||||
|
|
||||||
print()
|
if not opt.quiet:
|
||||||
print('Your identity is: %s <%s>' % (mp.config.GetString('user.name'),
|
print()
|
||||||
mp.config.GetString('user.email')))
|
print('Your identity is: %s <%s>' % (mp.config.GetString('user.name'),
|
||||||
print('If you want to change this, please re-run \'repo init\' with --config-name')
|
mp.config.GetString('user.email')))
|
||||||
|
print("If you want to change this, please re-run 'repo init' with --config-name")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _ConfigureUser(self):
|
def _ConfigureUser(self, opt):
|
||||||
mp = self.manifest.manifestProject
|
mp = self.manifest.manifestProject
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print()
|
if not opt.quiet:
|
||||||
|
print()
|
||||||
name = self._Prompt('Your Name', mp.UserName)
|
name = self._Prompt('Your Name', mp.UserName)
|
||||||
email = self._Prompt('Your Email', mp.UserEmail)
|
email = self._Prompt('Your Email', mp.UserEmail)
|
||||||
|
|
||||||
print()
|
if not opt.quiet:
|
||||||
|
print()
|
||||||
print('Your identity is: %s <%s>' % (name, email))
|
print('Your identity is: %s <%s>' % (name, email))
|
||||||
print('is this correct [y/N]? ', end='')
|
print('is this correct [y/N]? ', end='')
|
||||||
# TODO: When we require Python 3, use flush=True w/print above.
|
# TODO: When we require Python 3, use flush=True w/print above.
|
||||||
@ -445,15 +448,16 @@ to update the working directory files.
|
|||||||
# We store the depth in the main manifest project.
|
# We store the depth in the main manifest project.
|
||||||
self.manifest.manifestProject.config.SetString('repo.depth', depth)
|
self.manifest.manifestProject.config.SetString('repo.depth', depth)
|
||||||
|
|
||||||
def _DisplayResult(self):
|
def _DisplayResult(self, opt):
|
||||||
if self.manifest.IsMirror:
|
if self.manifest.IsMirror:
|
||||||
init_type = 'mirror '
|
init_type = 'mirror '
|
||||||
else:
|
else:
|
||||||
init_type = ''
|
init_type = ''
|
||||||
|
|
||||||
print()
|
if not opt.quiet:
|
||||||
print('repo %shas been initialized in %s'
|
print()
|
||||||
% (init_type, self.manifest.topdir))
|
print('repo %shas been initialized in %s' %
|
||||||
|
(init_type, self.manifest.topdir))
|
||||||
|
|
||||||
current_dir = os.getcwd()
|
current_dir = os.getcwd()
|
||||||
if current_dir != self.manifest.topdir:
|
if current_dir != self.manifest.topdir:
|
||||||
@ -487,8 +491,8 @@ to update the working directory files.
|
|||||||
self._LinkManifest(opt.manifest_name)
|
self._LinkManifest(opt.manifest_name)
|
||||||
|
|
||||||
if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
|
if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
|
||||||
if opt.config_name or self._ShouldConfigureUser():
|
if opt.config_name or self._ShouldConfigureUser(opt):
|
||||||
self._ConfigureUser()
|
self._ConfigureUser(opt)
|
||||||
self._ConfigureColor()
|
self._ConfigureColor()
|
||||||
|
|
||||||
self._DisplayResult()
|
self._DisplayResult(opt)
|
||||||
|
Loading…
Reference in New Issue
Block a user