changeset 30548:8d9745ff1e62

crecord: change the verb according to the operation This will make crecord consistent with record when being used in the revert situation. It will say "Select hunks to revert / discard" accordingly. This should make the revert crecord interface less confusing.
author Jun Wu <quark@fb.com>
date Mon, 28 Nov 2016 23:38:46 +0000
parents 5129ed3c2548
children 9e29d4e4e08b
files mercurial/crecord.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Mon Nov 28 23:37:29 2016 +0000
+++ b/mercurial/crecord.py	Mon Nov 28 23:38:46 2016 +0000
@@ -501,6 +501,12 @@
                 break
     return chunkselector.opts
 
+_headermessages = { # {operation: text}
+    'revert': _('Select hunks to revert'),
+    'discard': _('Select hunks to discard'),
+    None: _('Select hunks to record'),
+}
+
 class curseschunkselector(object):
     def __init__(self, headerlist, ui, operation=None):
         # put the headers into a patch object
@@ -557,6 +563,8 @@
         self.waslasttoggleallapplied = True
 
         # affects some ui text
+        if operation not in _headermessages:
+            raise RuntimeError('unexpected operation: %s' % operation)
         self.operation = operation
 
     def uparrowevent(self):
@@ -950,7 +958,7 @@
         """-> [str]. return segments"""
         selected = self.currentselecteditem.applied
         segments = [
-            _('Select hunks to record'),
+            _headermessages[self.operation],
             '-',
             _('[x]=selected **=collapsed'),
             _('c: confirm'),