comparison mercurial/cmdutil.py @ 31206:3af9a9628ecf

revert: always display hunks reversed when reverting to parent When reverting to the parent of working directory, operation is "discard" so we want hunks to be presented in the same order as the diff (i.e. "reversed"). So we do not query the experimental.revertalternateinteractivemode option in this case and always set "reversehunks" to True.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Mon, 06 Mar 2017 14:11:21 +0100
parents 1ec89cf0ea49
children 21fa3d3688f3
comparison
equal deleted inserted replaced
31205:6b098ac4542e 31206:3af9a9628ecf
3245 torevert = [repo.wjoin(f) for f in actions['revert'][0]] 3245 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3246 m = scmutil.match(ctx, torevert, matcher_opts) 3246 m = scmutil.match(ctx, torevert, matcher_opts)
3247 diffopts = patch.difffeatureopts(repo.ui, whitespace=True) 3247 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3248 diffopts.nodates = True 3248 diffopts.nodates = True
3249 diffopts.git = True 3249 diffopts.git = True
3250 reversehunks = repo.ui.configbool('experimental', 3250 operation = 'discard'
3251 'revertalternateinteractivemode', 3251 reversehunks = True
3252 True) 3252 if node != parent:
3253 operation = 'revert'
3254 reversehunks = repo.ui.configbool('experimental',
3255 'revertalternateinteractivemode',
3256 True)
3253 if reversehunks: 3257 if reversehunks:
3254 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) 3258 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3255 else: 3259 else:
3256 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) 3260 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3257 originalchunks = patch.parsepatch(diff) 3261 originalchunks = patch.parsepatch(diff)
3258 operation = 'discard' if node == parent else 'revert'
3259 3262
3260 try: 3263 try:
3261 3264
3262 chunks, opts = recordfilter(repo.ui, originalchunks, 3265 chunks, opts = recordfilter(repo.ui, originalchunks,
3263 operation=operation) 3266 operation=operation)