When passed a file pattern that does not match any file in the repository, "hg revert -i" just warns about it but then continues and asks about other modified files. This is different from the non-interactive case. I believe the command should just abort if none of specified file patterns exist (in which case, the user quite just likely made a typo). Step to reproduce: $ hg files a $ hg status A a $ hg rev b b: no such file in rev 000000000000 $ hg rev -i b b: no such file in rev 000000000000 diff --git a/a b/a new file mode 100644 examine changes to 'a'? [Ynesfdaq?]
Fixed by https://mercurial-scm.org/repo/hg/rev/a228b2f55ad6 Denis Laxalde <denis@laxalde.org> tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns As described in issue5789, when revert is called through: hg revert -i <some file that does not exist> we'd expect the command to abort early. Currently, it just warns about missing file but prompt about files unrelated to user arguments. (please test the fix)
Fixed by https://mercurial-scm.org/repo/hg/rev/39b3aab6231e Denis Laxalde <denis.laxalde@logilab.fr> 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. (please test the fix)
Bug was set to TESTING for 7 days, resolving