comparison mercurial/cmdutil.py @ 49032: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
comparison
equal deleted inserted replaced
49031:9be7da341885 49032:3f6ef67e7a60
3750 for f in actions[b'add'][0]: 3750 for f in actions[b'add'][0]:
3751 # Don't checkout modified files, they are already created by the diff 3751 # Don't checkout modified files, they are already created by the diff
3752 if f in newlyaddedandmodifiedfiles: 3752 if f in newlyaddedandmodifiedfiles:
3753 continue 3753 continue
3754 3754
3755 if interactive:
3756 choice = repo.ui.promptchoice(
3757 _(b"add new file %s (Yn)?$$ &Yes $$ &No") % uipathfn(f)
3758 )
3759 if choice != 0:
3760 continue
3755 prntstatusmsg(b'add', f) 3761 prntstatusmsg(b'add', f)
3756 checkout(f) 3762 checkout(f)
3757 repo.dirstate.set_tracked(f) 3763 repo.dirstate.set_tracked(f)
3758 3764
3759 for f in actions[b'undelete'][0]: 3765 for f in actions[b'undelete'][0]: