D8200: pull: add `--confirm` flag to confirm before writing changes
Closed by commit rHG476c8e427975: pull: add `--confirm` flag to confirm before writing changes (authored by pulkit). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs Review". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8200?vs=20501=20739 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8200/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8200 AFFECTED FILES mercurial/commands.py mercurial/configitems.py mercurial/exchange.py relnotes/next tests/test-completion.t tests/test-obsolete-distributed.t tests/test-obsolete.t tests/test-phases-exchange.t tests/test-pull-r.t CHANGE DETAILS diff --git a/tests/test-pull-r.t b/tests/test-pull-r.t --- a/tests/test-pull-r.t +++ b/tests/test-pull-r.t @@ -1,3 +1,9 @@ + $ cat <> $HGRCPATH + > [ui] + > interactive = true + > EOF + + $ hg init repo $ cd repo $ echo foo > foo @@ -42,12 +48,47 @@ $ hg heads -q --closed 2:effea6de0384 1:ed1b79f46b9a - $ hg pull + $ hg pull --confirm << EOF + > n + > EOF pulling from $TESTTMP/repo2 searching for changes adding changesets adding manifests adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull --config pull.confirm=true << EOF + > n + > EOF + pulling from $TESTTMP/repo2 + searching for changes + adding changesets + adding manifests + adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull --confirm << EOF + > y + > EOF + pulling from $TESTTMP/repo2 + searching for changes + adding changesets + adding manifests + adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? y added 2 changesets with 1 changes to 1 files new changesets 8c900227dd5d:00cfe9073916 (run 'hg update' to get a working copy) @@ -56,6 +97,12 @@ 2:effea6de0384 1:ed1b79f46b9a +pull--confirm config option should be ignored if HGPLAIN is set + $ HGPLAIN=1 hg pull --config pull.confirm=True + pulling from $TESTTMP/repo2 + searching for changes + no changes found + $ cd .. $ hg init copy diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t --- a/tests/test-phases-exchange.t +++ b/tests/test-phases-exchange.t @@ -326,12 +326,18 @@ o 0 public a-A - 054250a37db4 $ cd ../mu - $ hg pull ../nu + $ hg pull ../nu --confirm --config ui.interactive=True< y + > EOF pulling from ../nu searching for changes adding changesets adding manifests adding file changes + adding 2 changesets with 2 changes to 2 files + new changesets d6bcb4f74035:145e75495359 (2 drafts) + 4 local changesets will be published + accept incoming changes (yn)? y added 2 changesets with 2 changes to 2 files new changesets d6bcb4f74035:145e75495359 (2 drafts) 4 local changesets published diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -377,15 +377,53 @@ 2:245bde4270cd (public) [ ] add original_c 6:6f9641995072 (draft) [tip ] add n3w_3_c -Try to pull markers +Try to pull markers while testing pull --confirm (extinct changeset are excluded but marker are pushed) - $ hg pull ../tmpb + $ hg pull ../tmpb --confirm --config ui.interactive=true < n + > EOF pulling from ../tmpb requesting all changes adding changesets adding manifests adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ HGPLAIN=1 hg pull ../tmpb --confirm --config ui.interactive=true < n + > EOF + pulling from ../tmpb + requesting all changes + adding changesets + adding manifests + adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull ../tmpb --confirm --config ui.interactive=true < y + > EOF + pulling from ../tmpb + requesting all changes + adding changesets + adding manifests + adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? y added 4 changesets with 4 changes to 4
D8200: pull: add `--confirm` flag to confirm before writing changes
pulkit updated this revision to Diff 20501. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8200?vs=20406=20501 BRANCH default CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8200/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8200 AFFECTED FILES mercurial/commands.py mercurial/configitems.py mercurial/exchange.py relnotes/next tests/test-completion.t tests/test-obsolete-distributed.t tests/test-obsolete.t tests/test-phases-exchange.t tests/test-pull-r.t CHANGE DETAILS diff --git a/tests/test-pull-r.t b/tests/test-pull-r.t --- a/tests/test-pull-r.t +++ b/tests/test-pull-r.t @@ -1,3 +1,9 @@ + $ cat <> $HGRCPATH + > [ui] + > interactive = true + > EOF + + $ hg init repo $ cd repo $ echo foo > foo @@ -42,12 +48,47 @@ $ hg heads -q --closed 2:effea6de0384 1:ed1b79f46b9a - $ hg pull + $ hg pull --confirm << EOF + > n + > EOF pulling from $TESTTMP/repo2 searching for changes adding changesets adding manifests adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull --config pull.confirm=true << EOF + > n + > EOF + pulling from $TESTTMP/repo2 + searching for changes + adding changesets + adding manifests + adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull --confirm << EOF + > y + > EOF + pulling from $TESTTMP/repo2 + searching for changes + adding changesets + adding manifests + adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? y added 2 changesets with 1 changes to 1 files new changesets 8c900227dd5d:00cfe9073916 (run 'hg update' to get a working copy) @@ -56,6 +97,12 @@ 2:effea6de0384 1:ed1b79f46b9a +pull--confirm config option should be ignored if HGPLAIN is set + $ HGPLAIN=1 hg pull --config pull.confirm=True + pulling from $TESTTMP/repo2 + searching for changes + no changes found + $ cd .. $ hg init copy diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t --- a/tests/test-phases-exchange.t +++ b/tests/test-phases-exchange.t @@ -326,12 +326,18 @@ o 0 public a-A - 054250a37db4 $ cd ../mu - $ hg pull ../nu + $ hg pull ../nu --confirm --config ui.interactive=True< y + > EOF pulling from ../nu searching for changes adding changesets adding manifests adding file changes + adding 2 changesets with 2 changes to 2 files + new changesets d6bcb4f74035:145e75495359 (2 drafts) + 4 local changesets will be published + accept incoming changes (yn)? y added 2 changesets with 2 changes to 2 files new changesets d6bcb4f74035:145e75495359 (2 drafts) 4 local changesets published diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -377,15 +377,53 @@ 2:245bde4270cd (public) [ ] add original_c 6:6f9641995072 (draft) [tip ] add n3w_3_c -Try to pull markers +Try to pull markers while testing pull --confirm (extinct changeset are excluded but marker are pushed) - $ hg pull ../tmpb + $ hg pull ../tmpb --confirm --config ui.interactive=true < n + > EOF pulling from ../tmpb requesting all changes adding changesets adding manifests adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ HGPLAIN=1 hg pull ../tmpb --confirm --config ui.interactive=true < n + > EOF + pulling from ../tmpb + requesting all changes + adding changesets + adding manifests + adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull ../tmpb --confirm --config ui.interactive=true < y + > EOF + pulling from ../tmpb + requesting all changes + adding changesets + adding manifests + adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? y added 4 changesets with 4 changes to 4 files (+1 heads) 5 new obsolescence markers new changesets 1f0dee641bb7:6f9641995072 (1 drafts) diff --git a/tests/test-obsolete-distributed.t b/tests/test-obsolete-distributed.t ---
D8200: pull: add `--confirm` flag to confirm before writing changes
This revision now requires changes to proceed. durin42 added a comment. durin42 requested changes to this revision. (marking as needs-changes since we've got consensus) REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8200/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8200 To: pulkit, #hg-reviewers, durin42 Cc: marmoute, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8200: pull: add `--confirm` flag to confirm before writing changes
marmoute added inline comments. INLINE COMMENTS > durin42 wrote in exchange.py:1807 > I think this should probably respect HGPLAIN. Thoughts? > > (Note that doing so will require some reworking, because you probably want > `HGPLAIN=1 hg pull --confirm` to confirm, and it wouldn't if you just respect > HGPLAIN on this line.) From IRC discussion, HGPLAIN should result in the config option to be ignored, but the command line flag to be enforced. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8200/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8200 To: pulkit, #hg-reviewers Cc: marmoute, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8200: pull: add `--confirm` flag to confirm before writing changes
durin42 added inline comments. INLINE COMMENTS > exchange.py:1807 > with wlock, repo.lock(), pullop.trmanager: > +if repo.ui.configbool(b"pull", b"confirm"): > +add_confirm_callback(repo, pullop) I think this should probably respect HGPLAIN. Thoughts? (Note that doing so will require some reworking, because you probably want `HGPLAIN=1 hg pull --confirm` to confirm, and it wouldn't if you just respect HGPLAIN on this line.) REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8200/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8200 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D8200: pull: add `--confirm` flag to confirm before writing changes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This introduces a new flag to pull command `--confirm` and also a config option named `pull.confirm` which if used will prompt user describing changes which are pulled and asking whether to accept them or not. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8200 AFFECTED FILES mercurial/commands.py mercurial/configitems.py mercurial/exchange.py relnotes/next tests/test-completion.t tests/test-obsolete-distributed.t tests/test-obsolete.t tests/test-phases-exchange.t tests/test-pull-r.t CHANGE DETAILS diff --git a/tests/test-pull-r.t b/tests/test-pull-r.t --- a/tests/test-pull-r.t +++ b/tests/test-pull-r.t @@ -1,3 +1,9 @@ + $ cat <> $HGRCPATH + > [ui] + > interactive = true + > EOF + + $ hg init repo $ cd repo $ echo foo > foo @@ -42,12 +48,47 @@ $ hg heads -q --closed 2:effea6de0384 1:ed1b79f46b9a - $ hg pull + $ hg pull --confirm << EOF + > n + > EOF pulling from $TESTTMP/repo2 searching for changes adding changesets adding manifests adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull --config pull.confirm=true << EOF + > n + > EOF + pulling from $TESTTMP/repo2 + searching for changes + adding changesets + adding manifests + adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull --confirm << EOF + > y + > EOF + pulling from $TESTTMP/repo2 + searching for changes + adding changesets + adding manifests + adding file changes + adding 2 changesets with 1 changes to 1 files + new changesets 8c900227dd5d:00cfe9073916 + accept incoming changes (yn)? y added 2 changesets with 1 changes to 1 files new changesets 8c900227dd5d:00cfe9073916 (run 'hg update' to get a working copy) diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t --- a/tests/test-phases-exchange.t +++ b/tests/test-phases-exchange.t @@ -326,12 +326,18 @@ o 0 public a-A - 054250a37db4 $ cd ../mu - $ hg pull ../nu + $ hg pull ../nu --confirm --config ui.interactive=True< y + > EOF pulling from ../nu searching for changes adding changesets adding manifests adding file changes + adding 2 changesets with 2 changes to 2 files + new changesets d6bcb4f74035:145e75495359 (2 drafts) + 4 local changesets will be published + accept incoming changes (yn)? y added 2 changesets with 2 changes to 2 files new changesets d6bcb4f74035:145e75495359 (2 drafts) 4 local changesets published diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -380,12 +380,34 @@ Try to pull markers (extinct changeset are excluded but marker are pushed) - $ hg pull ../tmpb + $ hg pull ../tmpb --confirm --config ui.interactive=true < n + > EOF pulling from ../tmpb requesting all changes adding changesets adding manifests adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + $ hg pull ../tmpb --confirm --config ui.interactive=true < y + > EOF + pulling from ../tmpb + requesting all changes + adding changesets + adding manifests + adding file changes + adding 4 changesets with 4 changes to 4 files (+1 heads) + 5 new obsolescence markers + new changesets 1f0dee641bb7:6f9641995072 (1 drafts) + accept incoming changes (yn)? y added 4 changesets with 4 changes to 4 files (+1 heads) 5 new obsolescence markers new changesets 1f0dee641bb7:6f9641995072 (1 drafts) diff --git a/tests/test-obsolete-distributed.t b/tests/test-obsolete-distributed.t --- a/tests/test-obsolete-distributed.t +++ b/tests/test-obsolete-distributed.t @@ -138,12 +138,37 @@ $ hg up 'desc("ROOT")' 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg pull + $ hg pull --confirm --config ui.interactive=True << EOF + > n + > EOF pulling from $TESTTMP/distributed-chain-building/server searching for changes adding changesets adding manifests adding file changes + adding 1 changesets with 1 changes to 1 files (+1 heads) + 1 new obsolescence markers + obsoleting 1 changesets + new changesets 391a2bf12b1b (1 drafts) + accept incoming changes (yn)? n + transaction abort! + rollback completed + abort: user aborted + [255] + + $ hg pull --confirm --config