comparison mercurial/crecord.py @ 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 0bde7372e4c0
comparison
equal deleted inserted replaced
30547:5129ed3c2548 30548:8d9745ff1e62
499 while True: 499 while True:
500 if chunkselector.handlekeypressed(testcommands.pop(0), test=True): 500 if chunkselector.handlekeypressed(testcommands.pop(0), test=True):
501 break 501 break
502 return chunkselector.opts 502 return chunkselector.opts
503 503
504 _headermessages = { # {operation: text}
505 'revert': _('Select hunks to revert'),
506 'discard': _('Select hunks to discard'),
507 None: _('Select hunks to record'),
508 }
509
504 class curseschunkselector(object): 510 class curseschunkselector(object):
505 def __init__(self, headerlist, ui, operation=None): 511 def __init__(self, headerlist, ui, operation=None):
506 # put the headers into a patch object 512 # put the headers into a patch object
507 self.headerlist = patch(headerlist) 513 self.headerlist = patch(headerlist)
508 514
555 561
556 # if the last 'toggle all' command caused all changes to be applied 562 # if the last 'toggle all' command caused all changes to be applied
557 self.waslasttoggleallapplied = True 563 self.waslasttoggleallapplied = True
558 564
559 # affects some ui text 565 # affects some ui text
566 if operation not in _headermessages:
567 raise RuntimeError('unexpected operation: %s' % operation)
560 self.operation = operation 568 self.operation = operation
561 569
562 def uparrowevent(self): 570 def uparrowevent(self):
563 """ 571 """
564 try to select the previous item to the current item that has the 572 try to select the previous item to the current item that has the
948 956
949 def _getstatuslinesegments(self): 957 def _getstatuslinesegments(self):
950 """-> [str]. return segments""" 958 """-> [str]. return segments"""
951 selected = self.currentselecteditem.applied 959 selected = self.currentselecteditem.applied
952 segments = [ 960 segments = [
953 _('Select hunks to record'), 961 _headermessages[self.operation],
954 '-', 962 '-',
955 _('[x]=selected **=collapsed'), 963 _('[x]=selected **=collapsed'),
956 _('c: confirm'), 964 _('c: confirm'),
957 _('q: abort'), 965 _('q: abort'),
958 _('arrow keys: move/expand/collapse'), 966 _('arrow keys: move/expand/collapse'),