mercurial/patch.py
changeset 29326 d48fc6f318a3
parent 29283 14eee72c8d52
child 29341 0d83ad967bf8
--- a/mercurial/patch.py	Wed Jun 01 15:16:38 2016 +0200
+++ b/mercurial/patch.py	Tue Jun 07 10:37:19 2016 +0200
@@ -978,7 +978,19 @@
 def filterpatch(ui, headers, operation=None):
     """Interactively filter patch chunks into applied-only chunks"""
     if operation is None:
-        operation = _('record')
+        operation = 'record'
+    messages = {
+        'multiple': {
+            'discard': _("discard change %d/%d to '%s'?"),
+            'record': _("record change %d/%d to '%s'?"),
+            'revert': _("revert change %d/%d to '%s'?"),
+        }[operation],
+        'single': {
+            'discard': _("discard this change to '%s'?"),
+            'record': _("record this change to '%s'?"),
+            'revert': _("revert this change to '%s'?"),
+        }[operation],
+    }
 
     def prompt(skipfile, skipall, query, chunk):
         """prompt query, and process base inputs
@@ -1109,12 +1121,10 @@
             if skipfile is None and skipall is None:
                 chunk.pretty(ui)
             if total == 1:
-                msg = _("%s this change to '%s'?") % (operation,
-                                                      chunk.filename())
+                msg = messages['single'] % chunk.filename()
             else:
                 idx = pos - len(h.hunks) + i
-                msg = _("%s change %d/%d to '%s'?") % (operation, idx, total,
-                                                       chunk.filename())
+                msg = messages['multiple'] % (idx, total, chunk.filename())
             r, skipfile, skipall, newpatches = prompt(skipfile,
                     skipall, msg, chunk)
             if r: