On Tue, 13 Feb 2018 21:46:54 +0100, Denis Laxalde wrote: > # HG changeset patch > # User Denis Laxalde <de...@laxalde.org> > # Date 1518554564 -3600 > # Tue Feb 13 21:42:44 2018 +0100 > # Node ID a7d28fab177642e028e37b77727603601c3a76cb > # Parent 4b8c889eb9d0b7ca6883b93dbd476323c94f677f > # EXP-Topic revert-interactive-pats > revert: account for computed changes in interactive revert (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, when going through > patch.diff() with the resulting matcher (for which .always() is True), a > new changes tuple will be built that completely ignores patterns passed > by the user. 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 a 'changes' tuple (scmutil.status tuple) from > information computed during dirstate inspection in cmdutil.revert() and > pass this to _performrevert() which then hands it to patch.diff(), thus > avoiding re-computation of a 'changes' tuple when 'match.always is True'.
Perhaps we should instead build an exact matcher from a list of canonical paths: torevert = actions['revert'][0] # XXX needs to drop excluded_files m = scmutil.matchfiles(repo, torevert) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel