I decided to raise StateError here because the local and remote
repos are in an incompatible state. I think remote errors (exit code
- should be when something goes wrong on the remote and there's
nothing the user can do.
pulkit | |
mharbison72 |
hg-reviewers |
I decided to raise StateError here because the local and remote
repos are in an incompatible state. I think remote errors (exit code
nothing the user can do.
No Linters Available |
No Unit Test Coverage |
In D9391#141289, @mharbison72 wrote:
I agree with @mharbison72 here that StateError is better than InputError here. Input from the user was perfectly fine, the reason for error is the state of repositories.
In D9391#143114, @pulkit wrote:In D9391#141289, @mharbison72 wrote:I agree with @mharbison72 here that StateError is better than InputError here. Input from the user was perfectly fine, the reason for error is the state of repositories.
Done. Thanks for your input.
Path | Packages | |||
---|---|---|---|---|
M | mercurial/discovery.py (6 lines) | |||
M | tests/test-bookmarks-pushpull.t (6 lines) | |||
M | tests/test-exchange-obsmarkers-case-A3.t (2 lines) | |||
M | tests/test-obsolete-checkheads.t (8 lines) | |||
M | tests/test-phases-exchange.t (2 lines) | |||
M | tests/test-push-checkheads-multibranches-E3.t (2 lines) | |||
M | tests/test-push-checkheads-partial-C1.t (2 lines) | |||
M | tests/test-push-checkheads-partial-C2.t (2 lines) | |||
M | tests/test-push-checkheads-partial-C3.t (2 lines) | |||
M | tests/test-push-checkheads-partial-C4.t (2 lines) | |||
M | tests/test-push-checkheads-unpushed-D1.t (2 lines) | |||
M | tests/test-push-checkheads-unpushed-D2.t (2 lines) | |||
M | tests/test-push-checkheads-unpushed-D3.t (6 lines) | |||
M | tests/test-push-checkheads-unpushed-D4.t (2 lines) | |||
M | tests/test-push-checkheads-unpushed-D5.t (2 lines) | |||
M | tests/test-push-checkheads-unpushed-D6.t (2 lines) | |||
M | tests/test-push-warn.t (48 lines) | |||
M | tests/test-push.t (2 lines) | |||
M | tests/test-treediscovery-legacy.t (2 lines) | |||
M | tests/test-treediscovery.t (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
f6e0724f82b6 | ce555b6fc271 | Martin von Zweigbergk | Nov 23 2020, 7:39 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
bookmarkedheads.add(localbookmarks[bm]) | bookmarkedheads.add(localbookmarks[bm]) | ||||
return bookmarkedheads | return bookmarkedheads | ||||
def checkheads(pushop): | def checkheads(pushop): | ||||
"""Check that a push won't add any outgoing head | """Check that a push won't add any outgoing head | ||||
raise Abort error and display ui message as needed. | raise InputError error and display ui message as needed. | ||||
""" | """ | ||||
repo = pushop.repo.unfiltered() | repo = pushop.repo.unfiltered() | ||||
remote = pushop.remote | remote = pushop.remote | ||||
outgoing = pushop.outgoing | outgoing = pushop.outgoing | ||||
remoteheads = pushop.remoteheads | remoteheads = pushop.remoteheads | ||||
newbranch = pushop.newbranch | newbranch = pushop.newbranch | ||||
inc = bool(pushop.incoming) | inc = bool(pushop.incoming) | ||||
if closedbranches: | if closedbranches: | ||||
errmsg = _(b"push creates new remote branches: %s (%d closed)") % ( | errmsg = _(b"push creates new remote branches: %s (%d closed)") % ( | ||||
branchnames, | branchnames, | ||||
len(closedbranches), | len(closedbranches), | ||||
) | ) | ||||
else: | else: | ||||
errmsg = _(b"push creates new remote branches: %s") % branchnames | errmsg = _(b"push creates new remote branches: %s") % branchnames | ||||
hint = _(b"use 'hg push --new-branch' to create new remote branches") | hint = _(b"use 'hg push --new-branch' to create new remote branches") | ||||
raise error.Abort(errmsg, hint=hint) | raise error.InputError(errmsg, hint=hint) | ||||
# 2. Find heads that we need not warn about | # 2. Find heads that we need not warn about | ||||
nowarnheads = _nowarnheads(pushop) | nowarnheads = _nowarnheads(pushop) | ||||
# 3. Check for new heads. | # 3. Check for new heads. | ||||
# If there are more heads after the push than before, a suitable | # If there are more heads after the push than before, a suitable | ||||
# error message, depending on unsynced status, is displayed. | # error message, depending on unsynced status, is displayed. | ||||
errormsg = None | errormsg = None | ||||
) | ) | ||||
if branch is None: | if branch is None: | ||||
repo.ui.note(_(b"new remote heads:\n")) | repo.ui.note(_(b"new remote heads:\n")) | ||||
else: | else: | ||||
repo.ui.note(_(b"new remote heads on branch '%s':\n") % branch) | repo.ui.note(_(b"new remote heads on branch '%s':\n") % branch) | ||||
for h in dhs: | for h in dhs: | ||||
repo.ui.note(b" %s\n" % short(h)) | repo.ui.note(b" %s\n" % short(h)) | ||||
if errormsg: | if errormsg: | ||||
raise error.Abort(errormsg, hint=hint) | raise error.InputError(errormsg, hint=hint) | ||||
def _postprocessobsolete(pushop, futurecommon, candidate_newhs): | def _postprocessobsolete(pushop, futurecommon, candidate_newhs): | ||||
"""post process the list of new heads with obsolescence information | """post process the list of new heads with obsolescence information | ||||
Exists as a sub-function to contain the complexity and allow extensions to | Exists as a sub-function to contain the complexity and allow extensions to | ||||
experiment with smarter logic. | experiment with smarter logic. | ||||
$ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid | $ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid | ||||
$ cat ../hg2.pid >> $DAEMON_PIDS | $ cat ../hg2.pid >> $DAEMON_PIDS | ||||
$ hg push http://localhost:$HGPORT2/ | $ hg push http://localhost:$HGPORT2/ | ||||
pushing to http://localhost:$HGPORT2/ | pushing to http://localhost:$HGPORT2/ | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head c922c0139ca0 with bookmark 'Y' | abort: push creates new remote head c922c0139ca0 with bookmark 'Y' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg -R ../a book | $ hg -R ../a book | ||||
@ 1:0d2164f0ce0d | @ 1:0d2164f0ce0d | ||||
* X 1:0d2164f0ce0d | * X 1:0d2164f0ce0d | ||||
Y 3:f6fc62dde3c0 | Y 3:f6fc62dde3c0 | ||||
Z 1:0d2164f0ce0d | Z 1:0d2164f0ce0d | ||||
Unrelated marker does not alter the decision | Unrelated marker does not alter the decision | ||||
$ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | ||||
1 new obsolescence markers | 1 new obsolescence markers | ||||
$ hg push http://localhost:$HGPORT2/ | $ hg push http://localhost:$HGPORT2/ | ||||
pushing to http://localhost:$HGPORT2/ | pushing to http://localhost:$HGPORT2/ | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head c922c0139ca0 with bookmark 'Y' | abort: push creates new remote head c922c0139ca0 with bookmark 'Y' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg -R ../a book | $ hg -R ../a book | ||||
@ 1:0d2164f0ce0d | @ 1:0d2164f0ce0d | ||||
* X 1:0d2164f0ce0d | * X 1:0d2164f0ce0d | ||||
Y 3:f6fc62dde3c0 | Y 3:f6fc62dde3c0 | ||||
Z 1:0d2164f0ce0d | Z 1:0d2164f0ce0d | ||||
Update to a successor works | Update to a successor works | ||||
$ echo 2 > f2 | $ echo 2 > f2 | ||||
$ hg ci -qAmr | $ hg ci -qAmr | ||||
$ hg push -B X | $ hg push -B X | ||||
pushing to $TESTTMP/addmarks | pushing to $TESTTMP/addmarks | ||||
searching for changes | searching for changes | ||||
remote has heads on branch 'default' that are not known locally: a2a606d9ff1b | remote has heads on branch 'default' that are not known locally: a2a606d9ff1b | ||||
abort: push creates new remote head 54694f811df9 with bookmark 'X' | abort: push creates new remote head 54694f811df9 with bookmark 'X' | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../addmarks | $ cd ../addmarks | ||||
Check summary output for incoming/outgoing bookmarks | Check summary output for incoming/outgoing bookmarks | ||||
$ hg bookmarks -d X | $ hg bookmarks -d X | ||||
$ hg bookmarks -d Y | $ hg bookmarks -d Y | ||||
$ hg summary --remote | grep '^remote:' | $ hg summary --remote | grep '^remote:' | ||||
remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob) | remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob) |
check it complains about multiple heads | check it complains about multiple heads | ||||
$ cd A.3.b | $ cd A.3.b | ||||
$ hg push -R main -r 'desc(A1)' pushdest | $ hg push -R main -r 'desc(A1)' pushdest | ||||
pushing to pushdest | pushing to pushdest | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head e5ea8f9c7314 | abort: push creates new remote head e5ea8f9c7314 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd .. | $ cd .. | ||||
test obsmarkers exchange. | test obsmarkers exchange. | ||||
$ dotest A.3.b A1 -f | $ dotest A.3.b A1 -f | ||||
## Running testcase A.3.b | ## Running testcase A.3.b | ||||
# testing echange of "A1" (e5ea8f9c7314) | # testing echange of "A1" (e5ea8f9c7314) | ||||
## initial state | ## initial state |
Abort: old will still be an head because it's public. | Abort: old will still be an head because it's public. | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/remote | pushing to $TESTTMP/remote | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 71e3228bffe1 | abort: push creates new remote head 71e3228bffe1 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
old head is now public (public remote version) | old head is now public (public remote version) | ||||
============================================== | ============================================== | ||||
TODO: Not implemented yet. | TODO: Not implemented yet. | ||||
# setup | # setup | ||||
# | # | ||||
old exists remotely as draft. It is obsoleted by new but we don't push new. | old exists remotely as draft. It is obsoleted by new but we don't push new. | ||||
Push should abort on new head | Push should abort on new head | ||||
$ hg push -r 'desc("other")' | $ hg push -r 'desc("other")' | ||||
pushing to $TESTTMP/remote | pushing to $TESTTMP/remote | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head d7d41ccbd4de | abort: push creates new remote head d7d41ccbd4de | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
Both precursors and successors are already know remotely. Descendant adds heads | Both precursors and successors are already know remotely. Descendant adds heads | ||||
=============================================================================== | =============================================================================== | ||||
setup. (The obsolete marker is known locally only | setup. (The obsolete marker is known locally only | ||||
We do not have enought data to take the right decision, we should fail | We do not have enought data to take the right decision, we should fail | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/remote | pushing to $TESTTMP/remote | ||||
searching for changes | searching for changes | ||||
remote has heads on branch 'default' that are not known locally: c70b08862e08 | remote has heads on branch 'default' that are not known locally: c70b08862e08 | ||||
abort: push creates new remote head 71e3228bffe1 | abort: push creates new remote head 71e3228bffe1 | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
Pulling the missing data makes it work | Pulling the missing data makes it work | ||||
$ hg pull | $ hg pull | ||||
pulling from $TESTTMP/remote | pulling from $TESTTMP/remote | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
o b4952fcf48cf (public) add base | o b4952fcf48cf (public) add base | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/remote | pushing to $TESTTMP/remote | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 350a93b716be | abort: push creates new remote head 350a93b716be | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] |
$ hg -R ../mu phase --secret --force 967b449fbc94 | $ hg -R ../mu phase --secret --force 967b449fbc94 | ||||
test-debug-phase: move rev 9: 0 -> 2 | test-debug-phase: move rev 9: 0 -> 2 | ||||
test-debug-phase: move rev 10: 1 -> 2 | test-debug-phase: move rev 10: 1 -> 2 | ||||
$ hg push -r 435b5d83910c ../mu | $ hg push -r 435b5d83910c ../mu | ||||
pushing to ../mu | pushing to ../mu | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 435b5d83910c | abort: push creates new remote head 435b5d83910c | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push -fr 435b5d83910c ../mu # because the push will create new visible head | $ hg push -fr 435b5d83910c ../mu # because the push will create new visible head | ||||
pushing to ../mu | pushing to ../mu | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
adding file changes | adding file changes | ||||
added 0 changesets with 0 changes to 2 files | added 0 changesets with 0 changes to 2 files | ||||
test-debug-phase: move rev 9: 2 -> 0 | test-debug-phase: move rev 9: 2 -> 0 |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push -r 'desc("C1")' | $ hg push -r 'desc("C1")' | ||||
pushing to $TESTTMP/E1/server | pushing to $TESTTMP/E1/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head dc44c53142f0 | abort: push creates new remote head dc44c53142f0 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/C1/server | pushing to $TESTTMP/C1/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 25c56d33e4c4 | abort: push creates new remote head 25c56d33e4c4 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push --rev 'desc(A1)' | $ hg push --rev 'desc(A1)' | ||||
pushing to $TESTTMP/C2/server | pushing to $TESTTMP/C2/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head f6082bc4ffef | abort: push creates new remote head f6082bc4ffef | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/C3/server | pushing to $TESTTMP/C3/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 0f88766e02d6 | abort: push creates new remote head 0f88766e02d6 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push --rev 'desc(C0)' | $ hg push --rev 'desc(C0)' | ||||
pushing to $TESTTMP/C4/server | pushing to $TESTTMP/C4/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 0f88766e02d6 | abort: push creates new remote head 0f88766e02d6 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push -r 'desc(B0)' | $ hg push -r 'desc(B0)' | ||||
pushing to $TESTTMP/D1/server | pushing to $TESTTMP/D1/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 74ff5441d343 | abort: push creates new remote head 74ff5441d343 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. | ||||
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push --rev 'desc(C0)' | $ hg push --rev 'desc(C0)' | ||||
pushing to $TESTTMP/D2/server | pushing to $TESTTMP/D2/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 0f88766e02d6 | abort: push creates new remote head 0f88766e02d6 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push --rev 'desc(A1)' | $ hg push --rev 'desc(A1)' | ||||
pushing to $TESTTMP/D3/server | pushing to $TESTTMP/D3/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head f6082bc4ffef | abort: push creates new remote head f6082bc4ffef | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push --rev 'desc(B1)' | $ hg push --rev 'desc(B1)' | ||||
pushing to $TESTTMP/D3/server | pushing to $TESTTMP/D3/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 25c56d33e4c4 | abort: push creates new remote head 25c56d33e4c4 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
Extra testing | Extra testing | ||||
------------- | ------------- | ||||
In this case, even a bare push is creating more heads | In this case, even a bare push is creating more heads | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/D3/server | pushing to $TESTTMP/D3/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 25c56d33e4c4 | abort: push creates new remote head 25c56d33e4c4 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
Actual testing (new branch only) | Actual testing (new branch only) | ||||
-------------------------------- | -------------------------------- | ||||
$ hg push --rev 'desc(A1)' | $ hg push --rev 'desc(A1)' | ||||
pushing to $TESTTMP/D4/server | pushing to $TESTTMP/D4/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head f6082bc4ffef | abort: push creates new remote head f6082bc4ffef | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
Actual testing (existing branch only) | Actual testing (existing branch only) | ||||
------------------------------------ | ------------------------------------ | ||||
$ hg push --rev 'desc(B1)' | $ hg push --rev 'desc(B1)' | ||||
pushing to $TESTTMP/D4/server | pushing to $TESTTMP/D4/server | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
adding file changes | adding file changes | ||||
added 1 changesets with 1 changes to 1 files | added 1 changesets with 1 changes to 1 files | ||||
1 new obsolescence markers | 1 new obsolescence markers | ||||
obsoleted 1 changesets | obsoleted 1 changesets | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push --rev 'desc(B1)' | $ hg push --rev 'desc(B1)' | ||||
pushing to $TESTTMP/D5/server | pushing to $TESTTMP/D5/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 25c56d33e4c4 | abort: push creates new remote head 25c56d33e4c4 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push --rev 'desc(A1)' | $ hg push --rev 'desc(A1)' | ||||
pushing to $TESTTMP/D5/server | pushing to $TESTTMP/D5/server | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
adding file changes | adding file changes | ||||
added 1 changesets with 1 changes to 1 files | added 1 changesets with 1 changes to 1 files | ||||
1 new obsolescence markers | 1 new obsolescence markers | ||||
obsoleted 1 changesets | obsoleted 1 changesets | ||||
1 new orphan changesets | 1 new orphan changesets | ||||
$ cd ../.. | $ cd ../.. |
Actual testing | Actual testing | ||||
-------------- | -------------- | ||||
$ hg push --rev 'desc(C0)' | $ hg push --rev 'desc(C0)' | ||||
pushing to $TESTTMP/D6/server | pushing to $TESTTMP/D6/server | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 0f88766e02d6 | abort: push creates new remote head 0f88766e02d6 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd ../.. | $ cd ../.. |
[10] | [10] | ||||
$ hg push ../a | $ hg push ../a | ||||
pushing to ../a | pushing to ../a | ||||
searching for changes | searching for changes | ||||
remote has heads on branch 'default' that are not known locally: 1c9246a22a0a | remote has heads on branch 'default' that are not known locally: 1c9246a22a0a | ||||
abort: push creates new remote head 1e108cc5548c | abort: push creates new remote head 1e108cc5548c | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push --debug ../a | $ hg push --debug ../a | ||||
pushing to ../a | pushing to ../a | ||||
query 1; heads | query 1; heads | ||||
searching for changes | searching for changes | ||||
taking quick initial sample | taking quick initial sample | ||||
query 2; still undecided: 1, sample size is: 1 | query 2; still undecided: 1, sample size is: 1 | ||||
2 total queries in *.????s (glob) | 2 total queries in *.????s (glob) | ||||
listing keys for "phases" | listing keys for "phases" | ||||
checking for updated bookmarks | checking for updated bookmarks | ||||
listing keys for "bookmarks" | listing keys for "bookmarks" | ||||
listing keys for "bookmarks" | listing keys for "bookmarks" | ||||
remote has heads on branch 'default' that are not known locally: 1c9246a22a0a | remote has heads on branch 'default' that are not known locally: 1c9246a22a0a | ||||
new remote heads on branch 'default': | new remote heads on branch 'default': | ||||
1e108cc5548c | 1e108cc5548c | ||||
abort: push creates new remote head 1e108cc5548c | abort: push creates new remote head 1e108cc5548c | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg pull ../a | $ hg pull ../a | ||||
pulling from ../a | pulling from ../a | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
adding file changes | adding file changes | ||||
added 1 changesets with 1 changes to 1 files (+1 heads) | added 1 changesets with 1 changes to 1 files (+1 heads) | ||||
new changesets 1c9246a22a0a | new changesets 1c9246a22a0a | ||||
(run 'hg heads' to see heads, 'hg merge' to merge) | (run 'hg heads' to see heads, 'hg merge' to merge) | ||||
$ hg push ../a | $ hg push ../a | ||||
pushing to ../a | pushing to ../a | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 1e108cc5548c | abort: push creates new remote head 1e108cc5548c | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg merge | $ hg merge | ||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
(branch merge, don't forget to commit) | (branch merge, don't forget to commit) | ||||
$ hg commit -m "4" | $ hg commit -m "4" | ||||
$ hg push ../a | $ hg push ../a | ||||
pushing to ../a | pushing to ../a | ||||
$ hg ci -m c-d | $ hg ci -m c-d | ||||
$ hg push ../c | $ hg push ../c | ||||
pushing to ../c | pushing to ../c | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 6346d66eb9f5 | abort: push creates new remote head 6346d66eb9f5 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push -r 2 ../c | $ hg push -r 2 ../c | ||||
pushing to ../c | pushing to ../c | ||||
searching for changes | searching for changes | ||||
no changes found | no changes found | ||||
[1] | [1] | ||||
$ hg push -r 3 ../c | $ hg push -r 3 ../c | ||||
pushing to ../c | pushing to ../c | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head a5dda829a167 | abort: push creates new remote head a5dda829a167 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push -v -r 3 -r 4 ../c | $ hg push -v -r 3 -r 4 ../c | ||||
pushing to ../c | pushing to ../c | ||||
searching for changes | searching for changes | ||||
new remote heads on branch 'default': | new remote heads on branch 'default': | ||||
a5dda829a167 | a5dda829a167 | ||||
ee8fbc7a0295 | ee8fbc7a0295 | ||||
abort: push creates new remote head a5dda829a167 | abort: push creates new remote head a5dda829a167 | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push -v -f -r 3 -r 4 ../c | $ hg push -v -f -r 3 -r 4 ../c | ||||
pushing to ../c | pushing to ../c | ||||
searching for changes | searching for changes | ||||
2 changesets found | 2 changesets found | ||||
uncompressed size of bundle content: | uncompressed size of bundle content: | ||||
352 (changelog) | 352 (changelog) | ||||
326 (manifests) | 326 (manifests) | ||||
$ hg -q branch c | $ hg -q branch c | ||||
$ hg -q ci -m 5 | $ hg -q ci -m 5 | ||||
$ hg push ../f | $ hg push ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: c | abort: push creates new remote branches: c | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
$ hg push -r 4 -r 5 ../f | $ hg push -r 4 -r 5 ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: c | abort: push creates new remote branches: c | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
Multiple new branches: | Multiple new branches: | ||||
$ hg -q branch d | $ hg -q branch d | ||||
$ echo 6 > foo | $ echo 6 > foo | ||||
$ hg -q ci -m 6 | $ hg -q ci -m 6 | ||||
$ hg push ../f | $ hg push ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: c, d | abort: push creates new remote branches: c, d | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
$ hg push -r 4 -r 6 ../f | $ hg push -r 4 -r 6 ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: c, d | abort: push creates new remote branches: c, d | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
$ cd ../g | $ cd ../g | ||||
Fail on multiple head push: | Fail on multiple head push: | ||||
$ hg -q up 1 | $ hg -q up 1 | ||||
$ echo 7 > foo | $ echo 7 > foo | ||||
$ hg -q ci -m 7 | $ hg -q ci -m 7 | ||||
$ hg push -r 4 -r 7 ../f | $ hg push -r 4 -r 7 ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 0b715ef6ff8f on branch 'a' | abort: push creates new remote head 0b715ef6ff8f on branch 'a' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
Push replacement head on existing branches: | Push replacement head on existing branches: | ||||
$ hg -q up 3 | $ hg -q up 3 | ||||
$ echo 8 > foo | $ echo 8 > foo | ||||
$ hg -q ci -m 8 | $ hg -q ci -m 8 | ||||
$ hg push -r 7 -r 8 ../f | $ hg push -r 7 -r 8 ../f | ||||
$ hg -q branch e | $ hg -q branch e | ||||
$ hg -q ci -m 13d | $ hg -q ci -m 13d | ||||
$ hg push -r 12 -r 13 ../f | $ hg push -r 12 -r 13 ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: e | abort: push creates new remote branches: e | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
Using --new-branch to push new named branch: | Using --new-branch to push new named branch: | ||||
$ hg push --new-branch -r 12 -r 13 ../f | $ hg push --new-branch -r 12 -r 13 ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
$ hg -q up 14 | $ hg -q up 14 | ||||
$ echo 16 > foo | $ echo 16 > foo | ||||
$ hg -q ci -m 16 | $ hg -q ci -m 16 | ||||
$ hg push --branch f --new-branch ../f | $ hg push --branch f --new-branch ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
abort: push creates new branch 'f' with multiple heads | abort: push creates new branch 'f' with multiple heads | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push --branch f --new-branch --force ../f | $ hg push --branch f --new-branch --force ../f | ||||
pushing to ../f | pushing to ../f | ||||
searching for changes | searching for changes | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
adding file changes | adding file changes | ||||
added 3 changesets with 3 changes to 1 files (+1 heads) | added 3 changesets with 3 changes to 1 files (+1 heads) | ||||
$ for i in `"$PYTHON" $TESTDIR/seq.py 3`; do hg -R h up -q 0; echo $i > h/b; hg -R h ci -qAm$i; done | $ for i in `"$PYTHON" $TESTDIR/seq.py 3`; do hg -R h up -q 0; echo $i > h/b; hg -R h ci -qAm$i; done | ||||
$ hg -R i push h | $ hg -R i push h | ||||
pushing to h | pushing to h | ||||
searching for changes | searching for changes | ||||
remote has heads on branch 'default' that are not known locally: 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847 | remote has heads on branch 'default' that are not known locally: 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847 | ||||
abort: push creates new remote head 97bd0c84d346 | abort: push creates new remote head 97bd0c84d346 | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg -R h up -q 0; echo x > h/b; hg -R h ci -qAmx | $ hg -R h up -q 0; echo x > h/b; hg -R h ci -qAmx | ||||
$ hg -R i push h | $ hg -R i push h | ||||
pushing to h | pushing to h | ||||
searching for changes | searching for changes | ||||
remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 and 1 others | 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 | abort: push creates new remote head 97bd0c84d346 | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg -R i push h -v | $ hg -R i push h -v | ||||
pushing to h | pushing to h | ||||
searching for changes | searching for changes | ||||
remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847 | remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847 | ||||
new remote heads on branch 'default': | new remote heads on branch 'default': | ||||
97bd0c84d346 | 97bd0c84d346 | ||||
abort: push creates new remote head 97bd0c84d346 | abort: push creates new remote head 97bd0c84d346 | ||||
(pull and merge or see 'hg help push' for details about pushing new heads) | (pull and merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
Check prepush logic with merged branches: | Check prepush logic with merged branches: | ||||
$ hg init j | $ hg init j | ||||
$ hg -R j branch a | $ hg -R j branch a | ||||
marked working directory as branch a | marked working directory as branch a | ||||
(branches are permanent and global, did you want a bookmark?) | (branches are permanent and global, did you want a bookmark?) | ||||
$ hg -R k ci -m merge | $ hg -R k ci -m merge | ||||
$ hg -R k push -r a j | $ hg -R k push -r a j | ||||
pushing to j | pushing to j | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: b | abort: push creates new remote branches: b | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
Prepush -r should not allow you to sneak in new heads: | Prepush -r should not allow you to sneak in new heads: | ||||
$ hg init l | $ hg init l | ||||
$ cd l | $ cd l | ||||
$ echo a >> foo | $ echo a >> foo | ||||
$ hg -q add foo | $ hg -q add foo | ||||
$ hg -q merge 3 | $ hg -q merge 3 | ||||
$ hg -q ci -mma | $ hg -q ci -mma | ||||
$ hg push ../l -b b | $ hg push ../l -b b | ||||
pushing to ../l | pushing to ../l | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 451211cc22b0 on branch 'a' | abort: push creates new remote head 451211cc22b0 on branch 'a' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd .. | $ cd .. | ||||
Check prepush with new branch head on former topo non-head: | Check prepush with new branch head on former topo non-head: | ||||
$ hg init n | $ hg init n | ||||
$ cd n | $ cd n | ||||
4: B a3 | 4: B a3 | ||||
5: A b3 | 5: A b3 | ||||
$ hg push inner | $ hg push inner | ||||
pushing to inner | pushing to inner | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 7d0f4fb6cf04 on branch 'A' | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg push inner -r4 -r5 | $ hg push inner -r4 -r5 | ||||
pushing to inner | pushing to inner | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head 7d0f4fb6cf04 on branch 'A' | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ hg in inner | $ hg in inner | ||||
comparing with inner | comparing with inner | ||||
searching for changes | searching for changes | ||||
no changes found | no changes found | ||||
[1] | [1] | ||||
Test fail hook | Test fail hook | ||||
$ hg push inner --config hooks.fail-push="echo running fail-push hook" | $ hg push inner --config hooks.fail-push="echo running fail-push hook" | ||||
pushing to inner | pushing to inner | ||||
searching for changes | searching for changes | ||||
running fail-push hook | running fail-push hook | ||||
abort: push creates new remote head 7d0f4fb6cf04 on branch 'A' | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A' | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
$ cd .. | $ cd .. | ||||
Test regarding pushing of closed branch/branches(Issue6080) | Test regarding pushing of closed branch/branches(Issue6080) | ||||
$ hg init x | $ hg init x | ||||
$ cd x | $ cd x | ||||
$ hg -q branch a | $ hg -q branch a | ||||
$ hg -q ci -Am 0 | $ hg -q ci -Am 0 | ||||
$ hg ci --close-branch -m 'closing branch foo' | $ hg ci --close-branch -m 'closing branch foo' | ||||
$ hg -q up 0 | $ hg -q up 0 | ||||
$ hg push ../x | $ hg push ../x | ||||
pushing to ../x | pushing to ../x | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: foo (1 closed) | abort: push creates new remote branches: foo (1 closed) | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
When there is more than one closed branches | When there is more than one closed branches | ||||
$ hg -q branch bar | $ hg -q branch bar | ||||
$ echo 0 > bar | $ echo 0 > bar | ||||
$ hg -q ci -Am 0 | $ hg -q ci -Am 0 | ||||
$ hg ci --close-branch -m 'closing branch bar' | $ hg ci --close-branch -m 'closing branch bar' | ||||
$ hg -q up 0 | $ hg -q up 0 | ||||
$ hg push ../x | $ hg push ../x | ||||
pushing to ../x | pushing to ../x | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: bar, foo (2 closed) | abort: push creates new remote branches: bar, foo (2 closed) | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
When there are more than one new branches and not all are closed | When there are more than one new branches and not all are closed | ||||
$ hg -q branch bar1 | $ hg -q branch bar1 | ||||
$ echo 0 > bar1 | $ echo 0 > bar1 | ||||
$ hg -q ci -Am 0 | $ hg -q ci -Am 0 | ||||
$ hg -q up 0 | $ hg -q up 0 | ||||
$ hg push ../x | $ hg push ../x | ||||
pushing to ../x | pushing to ../x | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: bar, bar1, foo (2 closed) | abort: push creates new remote branches: bar, bar1, foo (2 closed) | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
$ cd .. | $ cd .. |
exporting bookmark push-this-bookmark | exporting bookmark push-this-bookmark | ||||
[1] | [1] | ||||
(test that -b (branch) works for specifying "revs") | (test that -b (branch) works for specifying "revs") | ||||
$ hg push -b default | $ hg push -b default | ||||
pushing to $TESTTMP/test-require-revs-dest | pushing to $TESTTMP/test-require-revs-dest | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote head [0-9a-f]+ (re) | abort: push creates new remote head [0-9a-f]+ (re) | ||||
(merge or see 'hg help push' for details about pushing new heads) | (merge or see 'hg help push' for details about pushing new heads) | ||||
[255] | [10] | ||||
(demonstrate that even though we don't have anything to exchange, we're still | (demonstrate that even though we don't have anything to exchange, we're still | ||||
showing the error) | showing the error) | ||||
$ hg push | $ hg push | ||||
pushing to $TESTTMP/test-require-revs-dest | pushing to $TESTTMP/test-require-revs-dest | ||||
abort: no revisions specified to push | abort: no revisions specified to push | ||||
(did you mean "hg push -r ."?) | (did you mean "hg push -r ."?) | ||||
[10] | [10] | ||||
$ hg push --config paths.default:pushrev=0 | $ hg push --config paths.default:pushrev=0 | ||||
pushing to $TESTTMP/test-require-revs-dest | pushing to $TESTTMP/test-require-revs-dest | ||||
searching for changes | searching for changes | ||||
no changes found | no changes found | ||||
[1] | [1] |
pulling from http://localhost:$HGPORT/ | pulling from http://localhost:$HGPORT/ | ||||
searching for changes | searching for changes | ||||
no changes found | no changes found | ||||
$ hg push $remote | $ hg push $remote | ||||
pushing to http://localhost:$HGPORT/ | pushing to http://localhost:$HGPORT/ | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: both, name1 | abort: push creates new remote branches: both, name1 | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
$ hg push $remote --new-branch | $ hg push $remote --new-branch | ||||
pushing to http://localhost:$HGPORT/ | pushing to http://localhost:$HGPORT/ | ||||
searching for changes | searching for changes | ||||
remote: adding changesets | remote: adding changesets | ||||
remote: adding manifests | remote: adding manifests | ||||
remote: adding file changes | remote: adding file changes | ||||
remote: added 6 changesets with 12 changes to 2 files | remote: added 6 changesets with 12 changes to 2 files | ||||
$ hg outgoing $remote | $ hg outgoing $remote |
pulling from http://localhost:$HGPORT/ | pulling from http://localhost:$HGPORT/ | ||||
searching for changes | searching for changes | ||||
no changes found | no changes found | ||||
$ hg push $remote | $ hg push $remote | ||||
pushing to http://localhost:$HGPORT/ | pushing to http://localhost:$HGPORT/ | ||||
searching for changes | searching for changes | ||||
abort: push creates new remote branches: both, name1 | abort: push creates new remote branches: both, name1 | ||||
(use 'hg push --new-branch' to create new remote branches) | (use 'hg push --new-branch' to create new remote branches) | ||||
[255] | [10] | ||||
$ hg push $remote --new-branch | $ hg push $remote --new-branch | ||||
pushing to http://localhost:$HGPORT/ | pushing to http://localhost:$HGPORT/ | ||||
searching for changes | searching for changes | ||||
remote: adding changesets | remote: adding changesets | ||||
remote: adding manifests | remote: adding manifests | ||||
remote: adding file changes | remote: adding file changes | ||||
remote: added 6 changesets with 12 changes to 2 files | remote: added 6 changesets with 12 changes to 2 files | ||||
$ hg outgoing $remote | $ hg outgoing $remote |