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