# HG changeset patch # User Jun Wu # Date 2016-11-28 23:38:46 # Node ID 8d9745ff1e62484203aa449b325a4e68912606f9 # Parent 5129ed3c254805be1550a106290fa1fac7903281 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. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -501,6 +501,12 @@ def testchunkselector(testfn, ui, header 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 @@ class curseschunkselector(object): 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 @@ class curseschunkselector(object): """-> [str]. return segments""" selected = self.currentselecteditem.applied segments = [ - _('Select hunks to record'), + _headermessages[self.operation], '-', _('[x]=selected **=collapsed'), _('c: confirm'),