comparison hgext/record.py @ 9048:86b4a9b0ddda

ui: extract choice from prompt avoid translating single characters (as l for _local or sym_link)
author Simon Heimberg <simohe@besonet.ch>
date Sun, 21 Jun 2009 01:13:19 +0200
parents 9dda4c73fc3b
children b4f259c1667a
comparison
equal deleted inserted replaced
9047:8263d98ffb1c 9048:86b4a9b0ddda
289 _('Record remaining changes to this &file'), 289 _('Record remaining changes to this &file'),
290 _('&Done, skip remaining changes and files'), 290 _('&Done, skip remaining changes and files'),
291 _('Record &all changes to all remaining files'), 291 _('Record &all changes to all remaining files'),
292 _('&Quit, recording no changes'), 292 _('&Quit, recording no changes'),
293 _('&?')) 293 _('&?'))
294 r = (ui.prompt("%s %s " % (query, resps), choices) 294 r = ui.promptchoice("%s %s " % (query, resps), choices)
295 or _('y')).lower() 295 if r == 7: # ?
296 if r == _('?'):
297 doc = gettext(record.__doc__) 296 doc = gettext(record.__doc__)
298 c = doc.find(_('y - record this change')) 297 c = doc.find(_('y - record this change'))
299 for l in doc[c:].splitlines(): 298 for l in doc[c:].splitlines():
300 if l: ui.write(l.strip(), '\n') 299 if l: ui.write(l.strip(), '\n')
301 continue 300 continue
302 elif r == _('s'): 301 elif r == 0: # yes
303 r = resp_file[0] = 'n' 302 ret = 'y'
304 elif r == _('f'): 303 elif r == 1: # no
305 r = resp_file[0] = 'y' 304 ret = 'n'
306 elif r == _('d'): 305 elif r == 2: # Skip
307 r = resp_all[0] = 'n' 306 ret = resp_file[0] = 'n'
308 elif r == _('a'): 307 elif r == 3: # file (Record remaining)
309 r = resp_all[0] = 'y' 308 ret = resp_file[0] = 'y'
310 elif r == _('q'): 309 elif r == 4: # done, skip remaining
310 ret = resp_all[0] = 'n'
311 elif r == 5: # all
312 ret = resp_all[0] = 'y'
313 elif r == 6: # quit
311 raise util.Abort(_('user quit')) 314 raise util.Abort(_('user quit'))
312 return r 315 return ret
313 pos, total = 0, len(chunks) - 1 316 pos, total = 0, len(chunks) - 1
314 while chunks: 317 while chunks:
315 chunk = chunks.pop() 318 chunk = chunks.pop()
316 if isinstance(chunk, header): 319 if isinstance(chunk, header):
317 # new-file mark 320 # new-file mark