Show More
@@ -247,8 +247,8 b' def filterpatch(ui, chunks):' | |||
|
247 | 247 | if resp_file[0] is not None: |
|
248 | 248 | return resp_file[0] |
|
249 | 249 | while True: |
|
250 |
r = (ui.prompt(query + _(' [Ynsfdaq?] '), '[Ynsfdaq?]?$' |
|
|
251 |
|
|
|
250 | r = (ui.prompt(query + _(' [Ynsfdaq?] '), '(?i)[Ynsfdaq?]?$') | |
|
251 | or 'y').lower() | |
|
252 | 252 | if r == '?': |
|
253 | 253 | c = record.__doc__.find('y - record this change') |
|
254 | 254 | for l in record.__doc__[c:].splitlines(): |
@@ -410,14 +410,18 b' class ui(object):' | |||
|
410 | 410 | line = line[:-1] |
|
411 | 411 | return line |
|
412 | 412 | |
|
413 |
def prompt(self, msg, pat=None, default="y" |
|
|
413 | def prompt(self, msg, pat=None, default="y"): | |
|
414 | """Prompt user with msg, read response, and ensure it matches pat | |
|
415 | ||
|
416 | If not interactive -- the default is returned | |
|
417 | """ | |
|
414 | 418 | if not self.interactive: return default |
|
415 | 419 | while True: |
|
416 | 420 | try: |
|
417 | 421 | r = self._readline(msg + ' ') |
|
418 | 422 | if not r: |
|
419 | 423 | return default |
|
420 |
if not pat or re.match(pat, r |
|
|
424 | if not pat or re.match(pat, r): | |
|
421 | 425 | return r |
|
422 | 426 | else: |
|
423 | 427 | self.write(_("unrecognized response\n")) |
General Comments 0
You need to be logged in to leave comments.
Login now