mercurial/ui.py
branchstable
changeset 21195 9336bc7dca8e
parent 21132 350dc24a553d
child 21955 6dfb78f18bdb
equal deleted inserted replaced
21194:476069509e72 21195:9336bc7dca8e
   687     def getpass(self, prompt=None, default=None):
   687     def getpass(self, prompt=None, default=None):
   688         if not self.interactive():
   688         if not self.interactive():
   689             return default
   689             return default
   690         try:
   690         try:
   691             self.write_err(self.label(prompt or _('password: '), 'ui.prompt'))
   691             self.write_err(self.label(prompt or _('password: '), 'ui.prompt'))
   692             return getpass.getpass('')
   692             # disable getpass() only if explicitly specified. it's still valid
       
   693             # to interact with tty even if fin is not a tty.
       
   694             if self.configbool('ui', 'nontty'):
       
   695                 return self.fin.readline().rstrip('\n')
       
   696             else:
       
   697                 return getpass.getpass('')
   693         except EOFError:
   698         except EOFError:
   694             raise util.Abort(_('response expected'))
   699             raise util.Abort(_('response expected'))
   695     def status(self, *msg, **opts):
   700     def status(self, *msg, **opts):
   696         '''write status message to output (if ui.quiet is False)
   701         '''write status message to output (if ui.quiet is False)
   697 
   702