[Updated] D12416: revert: ask user to confirm before tracking new file when interactive
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Apr 6 12:51:46 UTC 2022
Closed by commit rHG3f6ef67e7a60: revert: ask user to confirm before tracking new file when interactive (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D12416?vs=32723&id=32815#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12416?vs=32723&id=32815
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12416/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12416
AFFECTED FILES
mercurial/cmdutil.py
tests/test-revert-interactive.t
CHANGE DETAILS
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 @@
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 <<EOF
+ > 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)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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)
To: martinvonz, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220406/4e08c0f1/attachment-0002.html>
More information about the Mercurial-patches
mailing list