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 |