Mercurial > hg
diff contrib/revsetbenchmarks.py @ 36194:39b3aab6231e
revert: use an exact matcher in interactive diff selection (issue5789)
When going through _performrevert() in the interactive case, we build a
matcher with files to revert and pass it patch.diff() for later
selection of diff hunks to revert. The files set used to build the
matcher comes from dirstate and accounts for patterns explicitly passed
to revert ('hg revert -i <file>') and, in case of nonexistent pattern,
this set is empty (which is expected). Unfortunately, the matcher built
from scmutil.match(ctx, []) is wrong as it leads patch.diff() to rebuild
a 'changes' tuple with dirstate information, ignoring user-specified
pattern. This leads to the situation described in issue5789, where
one gets prompted about reverting files unrelated to specified patterns
because they made a typo or so.
We fix this by building an exact matcher with the correct set of file
paths (built earlier). Thanks to Yuya Nishihara for suggesting the
correct fix.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Wed, 14 Feb 2018 14:12:05 +0100 |
parents | 984c4d23d39c |
children | e2697acd9381 |