comparison mercurial/cmdutil.py @ 25424:69609f43c752

revert: add an experimental config to use inverted selection We had a discussion on the list about the interactive ui for revert. This patch adds a flag to allow people to test the second alternative (referred to as proposition 2 on the mailing list). It effectively inverts the signs in the
author Laurent Charignon <lcharignon@fb.com>
date Fri, 29 May 2015 13:11:52 -0700
parents 31f3636e9296
children 9724cbe2d546
comparison
equal deleted inserted replaced
25423:525fbf24b51b 25424:69609f43c752
3137 torevert = [repo.wjoin(f) for f in actions['revert'][0]] 3137 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3138 m = scmutil.match(ctx, torevert, {}) 3138 m = scmutil.match(ctx, torevert, {})
3139 diffopts = patch.difffeatureopts(repo.ui, whitespace=True) 3139 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3140 diffopts.nodates = True 3140 diffopts.nodates = True
3141 diffopts.git = True 3141 diffopts.git = True
3142 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) 3142 reversehunks = repo.ui.configbool('experimental',
3143 'revertalternateinteractivemode',
3144 False)
3145 if reversehunks:
3146 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3147 else:
3148 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3143 originalchunks = patch.parsepatch(diff) 3149 originalchunks = patch.parsepatch(diff)
3150
3144 try: 3151 try:
3152
3145 chunks = recordfilter(repo.ui, originalchunks) 3153 chunks = recordfilter(repo.ui, originalchunks)
3154 if reversehunks:
3155 chunks = patch.reversehunks(chunks)
3156
3146 except patch.PatchError, err: 3157 except patch.PatchError, err:
3147 raise util.Abort(_('error parsing patch: %s') % err) 3158 raise util.Abort(_('error parsing patch: %s') % err)
3148 3159
3149 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) 3160 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3150 # Apply changes 3161 # Apply changes