# HG changeset patch # User Boris Feld # Date 2017-04-24 15:13:24 # Node ID 51fdedd29b0acca6865ca3128d0e0bf2aa07bf09 # Parent 52cca17ac523b490acdab259e794e7c2898efeda record: update help message to use operation instead of "record" (issue5432) Update the hunk selector help message to use the operation name instead of using "record" for all operations. Extract the help message in the same way as other single and multiple message line. Update tests to make sure that both "revert" and "discard" variants are tested. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -992,6 +992,38 @@ def filterpatch(ui, headers, operation=N 'record': _("record this change to '%s'?"), 'revert': _("revert this change to '%s'?"), }[operation], + 'help': { + 'discard': _('[Ynesfdaq?]' + '$$ &Yes, discard this change' + '$$ &No, skip this change' + '$$ &Edit this change manually' + '$$ &Skip remaining changes to this file' + '$$ Discard remaining changes to this &file' + '$$ &Done, skip remaining changes and files' + '$$ Discard &all changes to all remaining files' + '$$ &Quit, discarding no changes' + '$$ &? (display help)'), + 'record': _('[Ynesfdaq?]' + '$$ &Yes, record this change' + '$$ &No, skip this change' + '$$ &Edit this change manually' + '$$ &Skip remaining changes to this file' + '$$ Record remaining changes to this &file' + '$$ &Done, skip remaining changes and files' + '$$ Record &all changes to all remaining files' + '$$ &Quit, recording no changes' + '$$ &? (display help)'), + 'revert': _('[Ynesfdaq?]' + '$$ &Yes, revert this change' + '$$ &No, skip this change' + '$$ &Edit this change manually' + '$$ &Skip remaining changes to this file' + '$$ Revert remaining changes to this &file' + '$$ &Done, skip remaining changes and files' + '$$ Revert &all changes to all remaining files' + '$$ &Quit, reverting no changes' + '$$ &? (display help)') + }[operation] } def prompt(skipfile, skipall, query, chunk): @@ -1010,16 +1042,7 @@ def filterpatch(ui, headers, operation=N if skipfile is not None: return skipfile, skipfile, skipall, newpatches while True: - resps = _('[Ynesfdaq?]' - '$$ &Yes, record this change' - '$$ &No, skip this change' - '$$ &Edit this change manually' - '$$ &Skip remaining changes to this file' - '$$ Record remaining changes to this &file' - '$$ &Done, skip remaining changes and files' - '$$ Record &all changes to all remaining files' - '$$ &Quit, recording no changes' - '$$ &? (display help)') + resps = messages['help'] r = ui.promptchoice("%s %s" % (query, resps)) ui.write("\n") if r == 8: # ? diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t --- a/tests/test-revert-interactive.t +++ b/tests/test-revert-interactive.t @@ -46,6 +46,7 @@ 10 run the same test than 8 from within > y > y > y + > ? > y > n > n @@ -88,6 +89,17 @@ 10 run the same test than 8 from within 3 4 5 + revert change 3/6 to 'folder1/g'? [Ynesfdaq?] ? + + y - yes, revert this change + n - no, skip this change + e - edit this change manually + s - skip remaining changes to this file + f - revert remaining changes to this file + d - done, skip remaining changes and files + a - revert all changes to all remaining files + q - quit, reverting no changes + ? - ? (display help) revert change 3/6 to 'folder1/g'? [Ynesfdaq?] y @@ -1,5 +2,6 @@ @@ -264,6 +276,7 @@ Test --no-backup M folder1/g $ hg revert --interactive f << EOF > y + > ? > y > n > n @@ -279,6 +292,17 @@ Test --no-backup 3 4 5 + discard change 1/2 to 'f'? [Ynesfdaq?] ? + + y - yes, discard this change + n - no, skip this change + e - edit this change manually + s - skip remaining changes to this file + f - discard remaining changes to this file + d - done, skip remaining changes and files + a - discard all changes to all remaining files + q - quit, discarding no changes + ? - ? (display help) discard change 1/2 to 'f'? [Ynesfdaq?] y @@ -2,6 +1,5 @@ @@ -436,4 +460,3 @@ Check the experimental config to invert forget added file newfile (Yn)? y $ hg status ? newfile -