[Updated] D9391: errors: raise StateError when push fails because it creates new heads
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Dec 16 04:35:39 UTC 2020
Closed by commit rHG9261f6c1d39b: errors: raise StateError when push fails because it creates new heads (authored by martinvonz).
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/D9391?vs=24284&id=24295
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9391/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9391
AFFECTED FILES
mercurial/discovery.py
tests/test-bookmarks-pushpull.t
tests/test-exchange-obsmarkers-case-A3.t
tests/test-obsolete-checkheads.t
tests/test-phases-exchange.t
tests/test-push-checkheads-multibranches-E3.t
tests/test-push-checkheads-partial-C1.t
tests/test-push-checkheads-partial-C2.t
tests/test-push-checkheads-partial-C3.t
tests/test-push-checkheads-partial-C4.t
tests/test-push-checkheads-unpushed-D1.t
tests/test-push-checkheads-unpushed-D2.t
tests/test-push-checkheads-unpushed-D3.t
tests/test-push-checkheads-unpushed-D4.t
tests/test-push-checkheads-unpushed-D5.t
tests/test-push-checkheads-unpushed-D6.t
tests/test-push-warn.t
tests/test-push.t
tests/test-treediscovery-legacy.t
tests/test-treediscovery.t
CHANGE DETAILS
diff --git a/tests/test-treediscovery.t b/tests/test-treediscovery.t
--- a/tests/test-treediscovery.t
+++ b/tests/test-treediscovery.t
@@ -271,7 +271,7 @@
searching for changes
abort: push creates new remote branches: both, name1
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
$ hg push $remote --new-branch
pushing to http://localhost:$HGPORT/
searching for changes
diff --git a/tests/test-treediscovery-legacy.t b/tests/test-treediscovery-legacy.t
--- a/tests/test-treediscovery-legacy.t
+++ b/tests/test-treediscovery-legacy.t
@@ -287,7 +287,7 @@
searching for changes
abort: push creates new remote branches: both, name1
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
$ hg push $remote --new-branch
pushing to http://localhost:$HGPORT/
searching for changes
diff --git a/tests/test-push.t b/tests/test-push.t
--- a/tests/test-push.t
+++ b/tests/test-push.t
@@ -387,7 +387,7 @@
searching for changes
abort: push creates new remote head [0-9a-f]+ (re)
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
(demonstrate that even though we don't have anything to exchange, we're still
showing the error)
$ hg push
diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t
--- a/tests/test-push-warn.t
+++ b/tests/test-push-warn.t
@@ -33,7 +33,7 @@
remote has heads on branch 'default' that are not known locally: 1c9246a22a0a
abort: push creates new remote head 1e108cc5548c
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push --debug ../a
pushing to ../a
@@ -51,7 +51,7 @@
1e108cc5548c
abort: push creates new remote head 1e108cc5548c
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg pull ../a
pulling from ../a
@@ -68,7 +68,7 @@
searching for changes
abort: push creates new remote head 1e108cc5548c
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg merge
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -121,7 +121,7 @@
searching for changes
abort: push creates new remote head 6346d66eb9f5
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push -r 2 ../c
pushing to ../c
@@ -134,7 +134,7 @@
searching for changes
abort: push creates new remote head a5dda829a167
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push -v -r 3 -r 4 ../c
pushing to ../c
@@ -144,7 +144,7 @@
ee8fbc7a0295
abort: push creates new remote head a5dda829a167
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push -v -f -r 3 -r 4 ../c
pushing to ../c
@@ -234,14 +234,14 @@
searching for changes
abort: push creates new remote branches: c
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
$ hg push -r 4 -r 5 ../f
pushing to ../f
searching for changes
abort: push creates new remote branches: c
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
Multiple new branches:
@@ -255,14 +255,14 @@
searching for changes
abort: push creates new remote branches: c, d
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
$ hg push -r 4 -r 6 ../f
pushing to ../f
searching for changes
abort: push creates new remote branches: c, d
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
$ cd ../g
@@ -278,7 +278,7 @@
searching for changes
abort: push creates new remote head 0b715ef6ff8f on branch 'a'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
Push replacement head on existing branches:
@@ -355,7 +355,7 @@
searching for changes
abort: push creates new remote branches: e
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
Using --new-branch to push new named branch:
@@ -383,7 +383,7 @@
searching for changes
abort: push creates new branch 'f' with multiple heads
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push --branch f --new-branch --force ../f
pushing to ../f
searching for changes
@@ -427,7 +427,7 @@
remote has heads on branch 'default' that are not known locally: 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847
abort: push creates new remote head 97bd0c84d346
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg -R h up -q 0; echo x > h/b; hg -R h ci -qAmx
$ hg -R i push h
pushing to h
@@ -435,7 +435,7 @@
remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 and 1 others
abort: push creates new remote head 97bd0c84d346
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg -R i push h -v
pushing to h
searching for changes
@@ -444,7 +444,7 @@
97bd0c84d346
abort: push creates new remote head 97bd0c84d346
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
Check prepush logic with merged branches:
@@ -479,7 +479,7 @@
searching for changes
abort: push creates new remote branches: b
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
Prepush -r should not allow you to sneak in new heads:
@@ -515,7 +515,7 @@
searching for changes
abort: push creates new remote head 451211cc22b0 on branch 'a'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ..
@@ -765,14 +765,14 @@
searching for changes
abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push inner -r4 -r5
pushing to inner
searching for changes
abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg in inner
comparing with inner
@@ -788,7 +788,7 @@
running fail-push hook
abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ..
@@ -817,7 +817,7 @@
searching for changes
abort: push creates new remote branches: foo (1 closed)
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
When there is more than one closed branches
$ hg -q branch bar
@@ -830,7 +830,7 @@
searching for changes
abort: push creates new remote branches: bar, foo (2 closed)
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
When there are more than one new branches and not all are closed
$ hg -q branch bar1
@@ -842,6 +842,6 @@
searching for changes
abort: push creates new remote branches: bar, bar1, foo (2 closed)
(use 'hg push --new-branch' to create new remote branches)
- [255]
+ [20]
$ cd ..
diff --git a/tests/test-push-checkheads-unpushed-D6.t b/tests/test-push-checkheads-unpushed-D6.t
--- a/tests/test-push-checkheads-unpushed-D6.t
+++ b/tests/test-push-checkheads-unpushed-D6.t
@@ -81,6 +81,6 @@
searching for changes
abort: push creates new remote head 0f88766e02d6
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-unpushed-D5.t b/tests/test-push-checkheads-unpushed-D5.t
--- a/tests/test-push-checkheads-unpushed-D5.t
+++ b/tests/test-push-checkheads-unpushed-D5.t
@@ -100,7 +100,7 @@
searching for changes
abort: push creates new remote head 25c56d33e4c4
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push --rev 'desc(A1)'
pushing to $TESTTMP/D5/server
searching for changes
diff --git a/tests/test-push-checkheads-unpushed-D4.t b/tests/test-push-checkheads-unpushed-D4.t
--- a/tests/test-push-checkheads-unpushed-D4.t
+++ b/tests/test-push-checkheads-unpushed-D4.t
@@ -111,7 +111,7 @@
searching for changes
abort: push creates new remote head f6082bc4ffef
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
Actual testing (existing branch only)
------------------------------------
diff --git a/tests/test-push-checkheads-unpushed-D3.t b/tests/test-push-checkheads-unpushed-D3.t
--- a/tests/test-push-checkheads-unpushed-D3.t
+++ b/tests/test-push-checkheads-unpushed-D3.t
@@ -93,13 +93,13 @@
searching for changes
abort: push creates new remote head f6082bc4ffef
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push --rev 'desc(B1)'
pushing to $TESTTMP/D3/server
searching for changes
abort: push creates new remote head 25c56d33e4c4
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
Extra testing
-------------
@@ -111,6 +111,6 @@
searching for changes
abort: push creates new remote head 25c56d33e4c4
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-unpushed-D2.t b/tests/test-push-checkheads-unpushed-D2.t
--- a/tests/test-push-checkheads-unpushed-D2.t
+++ b/tests/test-push-checkheads-unpushed-D2.t
@@ -94,6 +94,6 @@
searching for changes
abort: push creates new remote head 0f88766e02d6
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-unpushed-D1.t b/tests/test-push-checkheads-unpushed-D1.t
--- a/tests/test-push-checkheads-unpushed-D1.t
+++ b/tests/test-push-checkheads-unpushed-D1.t
@@ -73,7 +73,7 @@
searching for changes
abort: push creates new remote head 74ff5441d343
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-partial-C4.t b/tests/test-push-checkheads-partial-C4.t
--- a/tests/test-push-checkheads-partial-C4.t
+++ b/tests/test-push-checkheads-partial-C4.t
@@ -81,6 +81,6 @@
searching for changes
abort: push creates new remote head 0f88766e02d6
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-partial-C3.t b/tests/test-push-checkheads-partial-C3.t
--- a/tests/test-push-checkheads-partial-C3.t
+++ b/tests/test-push-checkheads-partial-C3.t
@@ -80,6 +80,6 @@
searching for changes
abort: push creates new remote head 0f88766e02d6
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-partial-C2.t b/tests/test-push-checkheads-partial-C2.t
--- a/tests/test-push-checkheads-partial-C2.t
+++ b/tests/test-push-checkheads-partial-C2.t
@@ -81,6 +81,6 @@
searching for changes
abort: push creates new remote head f6082bc4ffef
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-partial-C1.t b/tests/test-push-checkheads-partial-C1.t
--- a/tests/test-push-checkheads-partial-C1.t
+++ b/tests/test-push-checkheads-partial-C1.t
@@ -80,6 +80,6 @@
searching for changes
abort: push creates new remote head 25c56d33e4c4
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
diff --git a/tests/test-push-checkheads-multibranches-E3.t b/tests/test-push-checkheads-multibranches-E3.t
--- a/tests/test-push-checkheads-multibranches-E3.t
+++ b/tests/test-push-checkheads-multibranches-E3.t
@@ -89,6 +89,6 @@
searching for changes
abort: push creates new remote head dc44c53142f0
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../..
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
@@ -1017,7 +1017,7 @@
searching for changes
abort: push creates new remote head 435b5d83910c
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg push -fr 435b5d83910c ../mu # because the push will create new visible head
pushing to ../mu
searching for changes
diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t
+++ b/tests/test-obsolete-checkheads.t
@@ -97,7 +97,7 @@
searching for changes
abort: push creates new remote head 71e3228bffe1
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
old head is now public (public remote version)
==============================================
@@ -157,7 +157,7 @@
searching for changes
abort: push creates new remote head d7d41ccbd4de
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
@@ -269,7 +269,7 @@
remote has heads on branch 'default' that are not known locally: c70b08862e08
abort: push creates new remote head 71e3228bffe1
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
Pulling the missing data makes it work
@@ -319,4 +319,4 @@
searching for changes
abort: push creates new remote head 350a93b716be
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
diff --git a/tests/test-exchange-obsmarkers-case-A3.t b/tests/test-exchange-obsmarkers-case-A3.t
--- a/tests/test-exchange-obsmarkers-case-A3.t
+++ b/tests/test-exchange-obsmarkers-case-A3.t
@@ -201,7 +201,7 @@
searching for changes
abort: push creates new remote head e5ea8f9c7314
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ..
test obsmarkers exchange.
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -742,7 +742,7 @@
searching for changes
abort: push creates new remote head c922c0139ca0 with bookmark 'Y'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg -R ../a book
@ 1:0d2164f0ce0d
* X 1:0d2164f0ce0d
@@ -759,7 +759,7 @@
searching for changes
abort: push creates new remote head c922c0139ca0 with bookmark 'Y'
(merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ hg -R ../a book
@ 1:0d2164f0ce0d
* X 1:0d2164f0ce0d
@@ -1055,7 +1055,7 @@
remote has heads on branch 'default' that are not known locally: a2a606d9ff1b
abort: push creates new remote head 54694f811df9 with bookmark 'X'
(pull and merge or see 'hg help push' for details about pushing new heads)
- [255]
+ [20]
$ cd ../addmarks
Check summary output for incoming/outgoing bookmarks
diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -362,7 +362,7 @@
def checkheads(pushop):
"""Check that a push won't add any outgoing head
- raise Abort error and display ui message as needed.
+ raise StateError error and display ui message as needed.
"""
repo = pushop.repo.unfiltered()
@@ -409,7 +409,7 @@
else:
errmsg = _(b"push creates new remote branches: %s") % branchnames
hint = _(b"use 'hg push --new-branch' to create new remote branches")
- raise error.Abort(errmsg, hint=hint)
+ raise error.StateError(errmsg, hint=hint)
# 2. Find heads that we need not warn about
nowarnheads = _nowarnheads(pushop)
@@ -505,7 +505,7 @@
for h in dhs:
repo.ui.note(b" %s\n" % short(h))
if errormsg:
- raise error.Abort(errormsg, hint=hint)
+ raise error.StateError(errormsg, hint=hint)
def _postprocessobsolete(pushop, futurecommon, candidate_newhs):
To: martinvonz, #hg-reviewers, pulkit, mharbison72
Cc: pulkit, mharbison72, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201216/5f8cfd62/attachment-0002.html>
More information about the Mercurial-patches
mailing list