comparison hgext/record.py @ 20266:061766323061

record: use "ui.extractchoices()" to get the list of available responses Before this patch, record extension gets the list of available responses from online help document of "hg record" in the tricky way, even though the value passed to "ui.promptchoice()" has enough (maybe i18n-ed) information. This patch uses "ui.extractchoices()" to get the list of available responses.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 02 Dec 2013 00:50:30 +0900
parents a765611e06dc
children 0076643077a3
comparison
equal deleted inserted replaced
20265:e5803150ea1d 20266:061766323061
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 '''commands to interactively select changes for commit/qrefresh''' 8 '''commands to interactively select changes for commit/qrefresh'''
9 9
10 from mercurial.i18n import gettext, _ 10 from mercurial.i18n import _
11 from mercurial import cmdutil, commands, extensions, hg, patch 11 from mercurial import cmdutil, commands, extensions, hg, patch
12 from mercurial import util 12 from mercurial import util
13 import copy, cStringIO, errno, os, re, shutil, tempfile 13 import copy, cStringIO, errno, os, re, shutil, tempfile
14 14
15 cmdtable = {} 15 cmdtable = {}
284 return skipfile, skipfile, skipall, newpatches 284 return skipfile, skipfile, skipall, newpatches
285 while True: 285 while True:
286 resps = _('[Ynesfdaq?]' 286 resps = _('[Ynesfdaq?]'
287 '$$ &Yes, record this change' 287 '$$ &Yes, record this change'
288 '$$ &No, skip this change' 288 '$$ &No, skip this change'
289 '$$ &Edit the change manually' 289 '$$ &Edit this change manually'
290 '$$ &Skip remaining changes to this file' 290 '$$ &Skip remaining changes to this file'
291 '$$ Record remaining changes to this &file' 291 '$$ Record remaining changes to this &file'
292 '$$ &Done, skip remaining changes and files' 292 '$$ &Done, skip remaining changes and files'
293 '$$ Record &all changes to all remaining files' 293 '$$ Record &all changes to all remaining files'
294 '$$ &Quit, recording no changes' 294 '$$ &Quit, recording no changes'
295 '$$ &?') 295 '$$ &? (display help)')
296 r = ui.promptchoice("%s %s" % (query, resps)) 296 r = ui.promptchoice("%s %s" % (query, resps))
297 ui.write("\n") 297 ui.write("\n")
298 if r == 8: # ? 298 if r == 8: # ?
299 doc = gettext(record.__doc__) 299 for c, t in ui.extractchoices(resps)[1]:
300 c = doc.find('::') + 2 300 ui.write('%s - %s\n' % (c, t.lower()))
301 for l in doc[c:].splitlines():
302 if l.startswith(' '):
303 ui.write(l.strip(), '\n')
304 continue 301 continue
305 elif r == 0: # yes 302 elif r == 0: # yes
306 ret = True 303 ret = True
307 elif r == 1: # no 304 elif r == 1: # no
308 ret = False 305 ret = False