Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 49097:3f6ef67e7a60
revert: ask user to confirm before tracking new file when interactive
If interactively reverting from a commit with `hg revert -i -r`, we
would unconditionally add files from that commit that are not already
tracked in the working copy. We have prompts for adding back files
removed in the working copy, but that's specific to such files and
does not apply to adding files from another revision.
Differential Revision: https://phab.mercurial-scm.org/D12416
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 28 Mar 2022 10:43:10 -0700 |
parents | 9be7da341885 |
children | ea98850a136e |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Mar 28 10:43:06 2022 -0700 +++ b/mercurial/cmdutil.py Mon Mar 28 10:43:10 2022 -0700 @@ -3752,6 +3752,12 @@ 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)