diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3752,6 +3752,12 @@ def _performrevert( if f in newlyaddedandmodifiedfiles: continue + if interactive: + choice = repo.ui.promptchoice( + _(b"add new file %s (Yn)?$$ &Yes $$ &No") % uipathfn(f) + ) + if choice != 0: + continue prntstatusmsg(b'add', f) checkout(f) repo.dirstate.set_tracked(f) diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t --- a/tests/test-revert-interactive.t +++ b/tests/test-revert-interactive.t @@ -420,6 +420,19 @@ 3) Use interactive revert with editing ( forgetting newfile $ hg status ? newfile + $ rm newfile + $ hg up 0 + 1 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ hg status + $ hg revert -r 2 -i < y + > n + > EOF + add new file folder1/g (Yn)? y + adding folder1/g + add new file folder2/h (Yn)? n + $ hg status + A folder1/g When a line without EOL is selected during "revert -i" (issue5651)