Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed May 20 11:44:06 2015 -0500 +++ b/mercurial/cmdutil.py Fri May 29 13:11:52 2015 -0700 @@ -3139,10 +3139,21 @@ diffopts = patch.difffeatureopts(repo.ui, whitespace=True) diffopts.nodates = True diffopts.git = True - diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) + reversehunks = repo.ui.configbool('experimental', + 'revertalternateinteractivemode', + False) + if reversehunks: + diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) + else: + diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) originalchunks = patch.parsepatch(diff) + try: + chunks = recordfilter(repo.ui, originalchunks) + if reversehunks: + chunks = patch.reversehunks(chunks) + except patch.PatchError, err: raise util.Abort(_('error parsing patch: %s') % err)