mercurial/ui.py
changeset 5154 67afecb8d6cc
parent 5039 c87de77a7d9f
child 5337 8c5ef3b87cb1
equal deleted inserted replaced
5153:9555f3b9489d 5154:67afecb8d6cc
   401                 readline.read_history_file
   401                 readline.read_history_file
   402             except ImportError:
   402             except ImportError:
   403                 pass
   403                 pass
   404         return raw_input(prompt)
   404         return raw_input(prompt)
   405 
   405 
   406     def prompt(self, msg, pat=None, default="y"):
   406     def prompt(self, msg, pat=None, default="y", matchflags=0):
   407         if not self.interactive: return default
   407         if not self.interactive: return default
   408         try:
   408         try:
   409             r = self.readline(msg + ' ')
   409             r = self.readline(msg + ' ')
   410             if not pat or re.match(pat, r):
   410             if not pat or re.match(pat, r, matchflags):
   411                 return r
   411                 return r
   412             else:
   412             else:
   413                 self.write(_("unrecognized response\n"))
   413                 self.write(_("unrecognized response\n"))
   414         except EOFError:
   414         except EOFError:
   415             raise util.Abort(_('response expected'))
   415             raise util.Abort(_('response expected'))