hgext/patchbomb.py
changeset 15166 9ec9dd8d1b24
parent 15165 3a55cee825ba
child 15559 1830d0cc4bc1
equal deleted inserted replaced
15165:3a55cee825ba 15166:9ec9dd8d1b24
    57 command = cmdutil.command(cmdtable)
    57 command = cmdutil.command(cmdtable)
    58 
    58 
    59 def prompt(ui, prompt, default=None, rest=':'):
    59 def prompt(ui, prompt, default=None, rest=':'):
    60     if default:
    60     if default:
    61         prompt += ' [%s]' % default
    61         prompt += ' [%s]' % default
    62     prompt += rest
    62     return ui.prompt(prompt + rest, default)
    63     while True:
       
    64         result = ui.prompt(prompt, default=default)
       
    65         if not ui.interactive():
       
    66             return result
       
    67         if result is not None:
       
    68             return result
       
    69         elif default is not None:
       
    70             return default
       
    71         else:
       
    72             ui.warn(_('Please enter a valid value.\n'))
       
    73 
    63 
    74 def introwanted(opts, number):
    64 def introwanted(opts, number):
    75     '''is an introductory message apparently wanted?'''
    65     '''is an introductory message apparently wanted?'''
    76     return number > 1 or opts.get('intro') or opts.get('desc')
    66     return number > 1 or opts.get('intro') or opts.get('desc')
    77 
    67