mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
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.
This commit is contained in:
parent
1629d4ee7f
commit
c2ab815c76
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
'''commands to interactively select changes for commit/qrefresh'''
|
'''commands to interactively select changes for commit/qrefresh'''
|
||||||
|
|
||||||
from mercurial.i18n import gettext, _
|
from mercurial.i18n import _
|
||||||
from mercurial import cmdutil, commands, extensions, hg, patch
|
from mercurial import cmdutil, commands, extensions, hg, patch
|
||||||
from mercurial import util
|
from mercurial import util
|
||||||
import copy, cStringIO, errno, os, re, shutil, tempfile
|
import copy, cStringIO, errno, os, re, shutil, tempfile
|
||||||
@ -286,21 +286,18 @@ def filterpatch(ui, headers):
|
|||||||
resps = _('[Ynesfdaq?]'
|
resps = _('[Ynesfdaq?]'
|
||||||
'$$ &Yes, record this change'
|
'$$ &Yes, record this change'
|
||||||
'$$ &No, skip this change'
|
'$$ &No, skip this change'
|
||||||
'$$ &Edit the change manually'
|
'$$ &Edit this change manually'
|
||||||
'$$ &Skip remaining changes to this file'
|
'$$ &Skip remaining changes to this file'
|
||||||
'$$ Record remaining changes to this &file'
|
'$$ Record remaining changes to this &file'
|
||||||
'$$ &Done, skip remaining changes and files'
|
'$$ &Done, skip remaining changes and files'
|
||||||
'$$ Record &all changes to all remaining files'
|
'$$ Record &all changes to all remaining files'
|
||||||
'$$ &Quit, recording no changes'
|
'$$ &Quit, recording no changes'
|
||||||
'$$ &?')
|
'$$ &? (display help)')
|
||||||
r = ui.promptchoice("%s %s" % (query, resps))
|
r = ui.promptchoice("%s %s" % (query, resps))
|
||||||
ui.write("\n")
|
ui.write("\n")
|
||||||
if r == 8: # ?
|
if r == 8: # ?
|
||||||
doc = gettext(record.__doc__)
|
for c, t in ui.extractchoices(resps)[1]:
|
||||||
c = doc.find('::') + 2
|
ui.write('%s - %s\n' % (c, t.lower()))
|
||||||
for l in doc[c:].splitlines():
|
|
||||||
if l.startswith(' '):
|
|
||||||
ui.write(l.strip(), '\n')
|
|
||||||
continue
|
continue
|
||||||
elif r == 0: # yes
|
elif r == 0: # yes
|
||||||
ret = True
|
ret = True
|
||||||
|
@ -673,15 +673,15 @@ Help, quit
|
|||||||
diff --git a/subdir/f1 b/subdir/f1
|
diff --git a/subdir/f1 b/subdir/f1
|
||||||
1 hunks, 1 lines changed
|
1 hunks, 1 lines changed
|
||||||
examine changes to 'subdir/f1'? [Ynesfdaq?]
|
examine changes to 'subdir/f1'? [Ynesfdaq?]
|
||||||
y - record this change
|
y - yes, record this change
|
||||||
n - skip this change
|
n - no, skip this change
|
||||||
e - edit this change manually
|
e - edit this change manually
|
||||||
s - skip remaining changes to this file
|
s - skip remaining changes to this file
|
||||||
f - record remaining changes to this file
|
f - record remaining changes to this file
|
||||||
d - done, skip remaining changes and files
|
d - done, skip remaining changes and files
|
||||||
a - record all changes to all remaining files
|
a - record all changes to all remaining files
|
||||||
q - quit, recording no changes
|
q - quit, recording no changes
|
||||||
? - display help
|
? - ? (display help)
|
||||||
examine changes to 'subdir/f1'? [Ynesfdaq?]
|
examine changes to 'subdir/f1'? [Ynesfdaq?]
|
||||||
abort: user quit
|
abort: user quit
|
||||||
[255]
|
[255]
|
||||||
|
Loading…
Reference in New Issue
Block a user