comparison mercurial/cmdutil.py @ 29326:d48fc6f318a3

patch: define full messages for interactive record/revert Followup 14eee72c8d52 to provide complete context for proper localization. Also update cmdutil.recordfilter docstring to remove recommendation that "operation" argument should be translated. Indeed, for record/revert, we either go to patch.filterpatch or crecord.filterpatch (in curses mode) ; the former now build the full ui message from the operation parameter and the latter does not use this parameter (removing in a followup patch). For shelve, operation is not specified and this thus falls back to "record".
author Denis Laxalde <denis.laxalde@logilab.fr>
date Tue, 07 Jun 2016 10:37:19 +0200
parents 14eee72c8d52
children baab9ea4426c
comparison
equal deleted inserted replaced
29325:4f2f8baba2ff 29326:d48fc6f318a3
89 return patch.filterpatch(ui, originalhunks, operation) 89 return patch.filterpatch(ui, originalhunks, operation)
90 90
91 def recordfilter(ui, originalhunks, operation=None): 91 def recordfilter(ui, originalhunks, operation=None):
92 """ Prompts the user to filter the originalhunks and return a list of 92 """ Prompts the user to filter the originalhunks and return a list of
93 selected hunks. 93 selected hunks.
94 *operation* is used for ui purposes to indicate the user 94 *operation* is used for to build ui messages to indicate the user what
95 what kind of filtering they are doing: reverting, committing, shelving, etc. 95 kind of filtering they are doing: reverting, committing, shelving, etc.
96 *operation* has to be a translated string. 96 (see patch.filterpatch).
97 """ 97 """
98 usecurses = crecordmod.checkcurses(ui) 98 usecurses = crecordmod.checkcurses(ui)
99 testfile = ui.config('experimental', 'crecordtest', None) 99 testfile = ui.config('experimental', 'crecordtest', None)
100 oldwrite = setupwrapcolorwrite(ui) 100 oldwrite = setupwrapcolorwrite(ui)
101 try: 101 try:
3299 if reversehunks: 3299 if reversehunks:
3300 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) 3300 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3301 else: 3301 else:
3302 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) 3302 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3303 originalchunks = patch.parsepatch(diff) 3303 originalchunks = patch.parsepatch(diff)
3304 operation = _('discard') if node == parent else _('revert') 3304 operation = 'discard' if node == parent else 'revert'
3305 3305
3306 try: 3306 try:
3307 3307
3308 chunks, opts = recordfilter(repo.ui, originalchunks, 3308 chunks, opts = recordfilter(repo.ui, originalchunks,
3309 operation=operation) 3309 operation=operation)