Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 41536:d783c937aa53
revert: add prompt before undeleting a file in -i (issue6008)
This adds a prompt that asks whether or not a removed file is to be undeleted
in `hg revert -i`.
Differential Revision: https://phab.mercurial-scm.org/D5803
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Sun, 03 Feb 2019 01:02:24 +0530 |
parents | d75fde22de91 |
children | 3a01ce246ece |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Feb 02 13:16:46 2019 -0800 +++ b/mercurial/cmdutil.py Sun Feb 03 01:02:24 2019 +0530 @@ -3194,9 +3194,19 @@ if node == parent and p2 == nullid: normal = repo.dirstate.normal for f in actions['undelete'][0]: - prntstatusmsg('undelete', f) - checkout(f) - normal(f) + if interactive: + choice = repo.ui.promptchoice( + _("add back removed file %s (Yn)?$$ &Yes $$ &No") % f) + if choice == 0: + prntstatusmsg('undelete', f) + checkout(f) + normal(f) + else: + excluded_files.append(f) + else: + prntstatusmsg('undelete', f) + checkout(f) + normal(f) copied = copies.pathcopies(repo[parent], ctx)