[PATCH] tests: unify test-push-warn

Adrian Buehlmann adrian at cadifra.com
Mon Sep 13 10:38:58 CDT 2010


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1284391958 -7200
# Node ID 7dfbffaa830e8773a7b3382dc17ac37f65ba1fa0
# Parent  f1cc9be99faa40bf298015bc99d3f4ffb43c6a39
tests: unify test-push-warn

diff --git a/tests/test-push-warn.out b/tests/test-push-warn.out
deleted file mode 100644
--- a/tests/test-push-warn.out
+++ /dev/null
@@ -1,323 +0,0 @@
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-pushing to ../a
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(you should pull and merge or use push -f to force)
-pulling from ../a
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-(run 'hg heads' to see heads, 'hg merge' to merge)
-pushing to ../a
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-pushing to ../a
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 1 changes to 1 files
-adding foo
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-merging foo
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-pushing to ../c
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-255
-pushing to ../c
-searching for changes
-no changes found
-0
-pushing to ../c
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-255
-pushing to ../c
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-255
-pushing to ../c
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files (+2 heads)
-0
-pushing to ../c
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (-1 heads)
-0
-comparing with ../c
-searching for changes
-no changes found
-% issue 450
-pushing to ../e
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-0
-pushing to ../e
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-0
-% issue 736
-% push on existing branch and new branch
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: c!
-(use 'hg push --new-branch' to create new remote branches)
-255
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: c!
-(use 'hg push --new-branch' to create new remote branches)
-255
-% multiple new branches
-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
-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
-% fail on multiple head push
-pushing to ../f
-searching for changes
-abort: push creates new remote heads on branch 'a'!
-(did you forget to merge? use push -f to force)
-255
-% push replacement head on existing branches
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-0
-% merge of branch a to other branch b followed by unrelated push on branch a
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (-1 heads)
-0
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-0
-% cheating the counting algorithm
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-0
-% failed push of new named branch
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: e!
-(use 'hg push --new-branch' to create new remote branches)
-255
-% using --new-branch to push new named branch
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-0
-% checking prepush logic does not allow silently pushing multiple new heads
-adding init
-adding a
-updating to branch default
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding b
-created new head
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding c
-created new head
-pushing to h
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(you should pull and merge or use push -f to force)
-
-% check prepush logic with merged branches
-marked working directory as branch a
-adding foo
-updating to branch a
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch b
-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)
-pushing to j
-searching for changes
-abort: push creates new remote branches: b!
-(use 'hg push --new-branch' to create new remote branches)
-
-% prepush -r should not allow you to sneak in new heads
-pushing to ../l
-searching for changes
-abort: push creates new remote heads on branch 'a'!
-(did you forget to merge? use push -f to force)
-% check prepush with new branch head on former topo non-head
-marked working directory as branch A
-adding a
-marked working directory as branch B
-adding b
-updating to branch B
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding b1
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding a2
-%% glog of local
-@  2: A a2
-|
-| o  1: B b
-|/
-o  0: A a
-
-%% glog of remote
-@  2: B b1
-|
-o  1: B b
-|
-o  0: A a
-
-%% outgoing
-comparing with inner
-searching for changes
-2: A a2
-pushing to inner
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-% check prepush with new branch head on former topo head
-marked working directory as branch A
-adding a
-marked working directory as branch B
-adding b
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding a1
-updating to branch A
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding b1
-adding a2
-%% glog of local
-@  3: A a2
-|
-o  2: A a1
-|
-| o  1: B b
-|/
-o  0: A a
-
-%% glog of remote
-@  3: B b1
-|
-| o  2: A a1
-| |
-o |  1: B b
-|/
-o  0: A a
-
-%% outgoing
-comparing with inner
-searching for changes
-3: A a2
-pushing to inner
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-% check prepush with new branch head and new child of former branch head
-% but child is on different branch
-marked working directory as branch A
-adding a
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch B
-adding b
-updating to branch B
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch B
-created new head
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch A
-created new head
-%% glog of local
-@  5: A b3
-|
-| o  4: B a3
-| |
-o |  3: B b1
-| |
-o |  2: B b0
- /
-o  1: A a1
-|
-o  0: A a0
-
-%% glog of remote
-@  3: B b1
-|
-o  2: B b0
-
-o  1: A a1
-|
-o  0: A a0
-
-%% outgoing
-comparing with inner
-searching for changes
-4: B a3
-5: A b3
-pushing to inner
-searching for changes
-abort: push creates new remote heads on branch 'A'!
-(did you forget to merge? use push -f to force)
-pushing to inner
-searching for changes
-abort: push creates new remote heads on branch 'A'!
-(did you forget to merge? use push -f to force)
-comparing with inner
-searching for changes
-no changes found
diff --git a/tests/test-push-warn b/tests/test-push-warn.t
old mode 100755
new mode 100644
rename from tests/test-push-warn
rename to tests/test-push-warn.t
--- a/tests/test-push-warn
+++ b/tests/test-push-warn.t
@@ -1,317 +1,701 @@
-#!/bin/sh
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "graphlog=" >> $HGRCPATH
 
-echo "[extensions]" >> $HGRCPATH
-echo "graphlog=" >> $HGRCPATH
+  $ mkdir a
+  $ cd a
+  $ hg init
+  $ echo foo > t1
+  $ hg add t1
+  $ hg commit -m "1"
 
-mkdir a
-cd a
-hg init
-echo foo > t1
-hg add t1
-hg commit -m "1"
+  $ cd ..
+  $ hg clone a b
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-cd ..
-hg clone a b
+  $ cd a
+  $ echo foo > t2
+  $ hg add t2
+  $ hg commit -m "2"
 
-cd a
-echo foo > t2
-hg add t2
-hg commit -m "2"
+  $ cd ../b
+  $ echo foo > t3
+  $ hg add t3
+  $ hg commit -m "3"
 
-cd ../b
-echo foo > t3
-hg add t3
-hg commit -m "3"
+  $ hg push ../a
+  pushing to ../a
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (you should pull and merge or use push -f to force)
 
-hg push ../a
-hg pull ../a
-hg push ../a
-hg merge
-hg commit -m "4"
-hg push ../a
-cd ..
+  $ hg pull ../a
+  pulling from ../a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
 
-hg init c
-cd c
-for i in 0 1 2; do
-    echo $i >> foo
-    hg ci -Am $i
-done
-cd ..
+  $ hg push ../a
+  pushing to ../a
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
 
-hg clone c d
-cd d
-for i in 0 1; do
-    hg co -C $i
-    echo d-$i >> foo
-    hg ci -m d-$i
-done
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
 
-HGMERGE=true hg merge 3
-hg ci -m c-d
+  $ hg commit -m "4"
+  $ hg push ../a
+  pushing to ../a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 1 changes to 1 files
 
-hg push ../c; echo $?
-hg push -r 2 ../c; echo $?
-hg push -r 3 ../c; echo $?
-hg push -r 3 -r 4 ../c; echo $?
-hg push -f -r 3 -r 4 ../c; echo $?
-hg push -r 5 ../c; echo $?
-hg in ../c
+  $ cd ..
 
-echo % issue 450
-hg init ../e
-hg push -r 0 ../e ; echo $?
-hg push -r 1 ../e ; echo $?
+  $ hg init c
+  $ cd c
+  $ for i in 0 1 2; do
+  >     echo $i >> foo
+  >     hg ci -Am $i
+  > done
+  adding foo
+  $ cd ..
 
-cd ..
+  $ hg clone c d
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-echo % issue 736
-hg init f
-cd f
-hg -q branch a
-echo 0 > foo
-hg -q ci -Am 0
-echo 1 > foo
-hg -q ci -m 1
-hg -q up 0
-echo 2 > foo
-hg -q ci -m 2
-hg -q up 0
-hg -q branch b
-echo 3 > foo
-hg -q ci -m 3
-cd ..
+  $ cd d
+  $ for i in 0 1; do
+  >    hg co -C $i
+  >    echo d-$i >> foo
+  >    hg ci -m d-$i
+  > done
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  created new head
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  created new head
 
-hg -q clone f g
-cd g
+  $ HGMERGE=true hg merge 3
+  merging foo
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
 
-echo % push on existing branch and new branch
-hg -q up 1
-echo 4 > foo
-hg -q ci -m 4
-hg -q up 0
-echo 5 > foo
-hg -q branch c
-hg -q ci -m 5
-hg push ../f; echo $?
-hg push -r 4 -r 5 ../f; echo $?
+  $ hg ci -m c-d
 
-echo % multiple new branches
-hg -q branch d
-echo 6 > foo
-hg -q ci -m 6
-hg push ../f; echo $?
-hg push -r 4 -r 6 ../f; echo $?
-cd ../g
+  $ hg push ../c; echo $?
+  pushing to ../c
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+  255
 
-echo % fail on multiple head push
-hg -q up 1
-echo 7 > foo
-hg -q ci -m 7
-hg push -r 4 -r 7 ../f; echo $?
+  $ hg push -r 2 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  no changes found
+  0
 
-echo % push replacement head on existing branches
-hg -q up 3
-echo 8 > foo
-hg -q ci -m 8
-hg push -r 7 -r 8 ../f; echo $?
+  $ hg push -r 3 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+  255
 
-echo % merge of branch a to other branch b followed by unrelated push on branch a
-hg -q up 7
-HGMERGE=true hg -q merge 8
-hg -q ci -m 9
-hg -q up 8
-echo 10 > foo
-hg -q ci -m 10
-hg push -r 9 ../f; echo $?
-hg push -r 10 ../f; echo $?
+  $ hg push -r 3 -r 4 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+  255
 
-echo % cheating the counting algorithm
-hg -q up 9
-HGMERGE=true hg -q merge 2
-hg -q ci -m 11
-hg -q up 1
-echo 12 > foo
-hg -q ci -m 12
-hg push -r 11 -r 12 ../f; echo $?
+  $ hg push -f -r 3 -r 4 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files (+2 heads)
+  0
 
-echo % failed push of new named branch
-echo 12 > foo
-hg -q ci -m 12a
-hg -q up 11
-echo 13 > foo
-hg -q branch e
-hg -q ci -m 13d
-hg push -r 12 -r 13 ../f; echo $?
+  $ hg push -r 5 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (-1 heads)
+  0
 
-echo % using --new-branch to push new named branch
-hg push --new-branch -r 12 -r 13 ../f; echo $?
+  $ hg in ../c
+  comparing with ../c
+  searching for changes
+  no changes found
 
-echo % checking prepush logic does not allow silently pushing multiple new heads
-cd ..
-hg init h
-echo init > h/init
-hg -R h ci -Am init
-echo a > h/a
-hg -R h ci -Am a
-hg clone h i
-hg -R h up 0
-echo b > h/b
-hg -R h ci -Am b
-hg -R i up 0
-echo c > i/c
-hg -R i ci -Am c
-hg -R i push h
-echo
 
-echo % check prepush logic with merged branches
-hg init j
-hg -R j branch a
-echo init > j/foo
-hg -R j ci -Am init
-hg clone j k
-echo a1 > j/foo
-hg -R j ci -m a1
-hg -R k branch b
-echo b > k/foo
-hg -R k ci -m b
-hg -R k up 0
-hg -R k merge b
-hg -R k ci -m merge
-hg -R k push -r a j
-echo
+Issue 450:
 
-echo % prepush -r should not allow you to sneak in new heads
-hg init l
-cd l
-echo a >> foo
-hg -q add foo
-hg -q branch a
-hg -q ci -ma
-hg -q up null
-echo a >> foo
-hg -q add foo
-hg -q branch b
-hg -q ci -mb
-cd ..
-hg -q clone l m -u a
-cd m
-hg -q merge b
-hg -q ci -mmb
-hg -q up 0
-echo a >> foo
-hg -q ci -ma2
-hg -q up 2
-echo a >> foo
-hg -q branch -f b
-hg -q ci -mb2
-hg -q merge 3
-hg -q ci -mma
-hg push ../l -b b
-cd ..
+  $ hg init ../e
+  $ hg push -r 0 ../e ; echo $?
+  pushing to ../e
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  0
 
-echo % check prepush with new branch head on former topo non-head
-hg init n
-cd n
-hg branch A
-echo a >a
-hg ci -Ama
-hg branch B
-echo b >b
-hg ci -Amb
+  $ hg push -r 1 ../e ; echo $?
+  pushing to ../e
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  0
+
+  $ cd ..
+
+
+Issue 736:
+
+  $ hg init f
+  $ cd f
+  $ hg -q branch a
+  $ echo 0 > foo
+  $ hg -q ci -Am 0
+  $ echo 1 > foo
+  $ hg -q ci -m 1
+  $ hg -q up 0
+  $ echo 2 > foo
+  $ hg -q ci -m 2
+  $ hg -q up 0
+  $ hg -q branch b
+  $ echo 3 > foo
+  $ hg -q ci -m 3
+  $ cd ..
+
+  $ hg -q clone f g
+  $ cd g
+
+Push on existing branch and new branch:
+
+  $ hg -q up 1
+  $ echo 4 > foo
+  $ hg -q ci -m 4
+  $ hg -q up 0
+  $ echo 5 > foo
+  $ hg -q branch c
+  $ hg -q ci -m 5
+
+  $ hg push ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: c!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+  $ hg push -r 4 -r 5 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: c!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+
+Multiple new branches:
+
+  $ hg -q branch d
+  $ echo 6 > foo
+  $ hg -q ci -m 6
+
+  $ hg push ../f; echo $?
+  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
+
+  $ hg push -r 4 -r 6 ../f; echo $?
+  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
+
+  $ cd ../g
+
+
+Fail on multiple head push:
+
+  $ hg -q up 1
+  $ echo 7 > foo
+  $ hg -q ci -m 7
+
+  $ hg push -r 4 -r 7 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote heads on branch 'a'!
+  (did you forget to merge? use push -f to force)
+  255
+
+Push replacement head on existing branches:
+
+  $ hg -q up 3
+  $ echo 8 > foo
+  $ hg -q ci -m 8
+
+  $ hg push -r 7 -r 8 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  0
+
+
+Merge of branch a to other branch b followed by unrelated push
+on branch a:
+
+  $ hg -q up 7
+  $ HGMERGE=true hg -q merge 8
+  $ hg -q ci -m 9
+  $ hg -q up 8
+  $ echo 10 > foo
+  $ hg -q ci -m 10
+
+  $ hg push -r 9 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (-1 heads)
+  0
+
+  $ hg push -r 10 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  0
+
+
+Cheating the counting algorithm:
+
+  $ hg -q up 9
+  $ HGMERGE=true hg -q merge 2
+  $ hg -q ci -m 11
+  $ hg -q up 1
+  $ echo 12 > foo
+  $ hg -q ci -m 12
+
+  $ hg push -r 11 -r 12 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  0
+
+
+Failed push of new named branch:
+
+  $ echo 12 > foo
+  $ hg -q ci -m 12a
+  $ hg -q up 11
+  $ echo 13 > foo
+  $ hg -q branch e
+  $ hg -q ci -m 13d
+
+  $ hg push -r 12 -r 13 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: e!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+
+Using --new-branch to push new named branch:
+
+  $ hg push --new-branch -r 12 -r 13 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  0
+
+
+Checking prepush logic does not allow silently pushing 
+multiple new heads:
+
+  $ cd ..
+  $ hg init h
+  $ echo init > h/init
+  $ hg -R h ci -Am init
+  adding init
+  $ echo a > h/a
+  $ hg -R h ci -Am a
+  adding a
+  $ hg clone h i
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -R h up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo b > h/b
+  $ hg -R h ci -Am b
+  adding b
+  created new head
+  $ hg -R i up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo c > i/c
+  $ hg -R i ci -Am c
+  adding c
+  created new head
+
+  $ hg -R i push h
+  pushing to h
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (you should pull and merge or use push -f to force)
+
+
+Check prepush logic with merged branches:
+
+  $ hg init j
+  $ hg -R j branch a
+  marked working directory as branch a
+  $ echo init > j/foo
+  $ hg -R j ci -Am init
+  adding foo
+  $ hg clone j k
+  updating to branch a
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a1 > j/foo
+  $ hg -R j ci -m a1
+  $ hg -R k branch b
+  marked working directory as branch b
+  $ echo b > k/foo
+  $ hg -R k ci -m b
+  $ hg -R k up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg -R k merge b
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg -R k ci -m merge
+
+  $ hg -R k push -r a j
+  pushing to j
+  searching for changes
+  abort: push creates new remote branches: b!
+  (use 'hg push --new-branch' to create new remote branches)
+
+
+Prepush -r should not allow you to sneak in new heads:
+
+  $ hg init l
+  $ cd l
+  $ echo a >> foo
+  $ hg -q add foo
+  $ hg -q branch a
+  $ hg -q ci -ma
+  $ hg -q up null
+  $ echo a >> foo
+  $ hg -q add foo
+  $ hg -q branch b
+  $ hg -q ci -mb
+  $ cd ..
+  $ hg -q clone l m -u a
+  $ cd m
+  $ hg -q merge b
+  $ hg -q ci -mmb
+  $ hg -q up 0
+  $ echo a >> foo
+  $ hg -q ci -ma2
+  $ hg -q up 2
+  $ echo a >> foo
+  $ hg -q branch -f b
+  $ hg -q ci -mb2
+  $ hg -q merge 3
+  $ hg -q ci -mma
+
+  $ hg push ../l -b b
+  pushing to ../l
+  searching for changes
+  abort: push creates new remote heads on branch 'a'!
+  (did you forget to merge? use push -f to force)
+
+  $ cd ..
+
+
+Check prepush with new branch head on former topo non-head:
+
+  $ hg init n
+  $ cd n
+  $ hg branch A
+  marked working directory as branch A
+  $ echo a >a
+  $ hg ci -Ama
+  adding a
+  $ hg branch B
+  marked working directory as branch B
+  $ echo b >b
+  $ hg ci -Amb
+  adding b
+
 # b is now branch head of B, and a topological head
 # a is now branch head of A, but not a topological head
-hg clone . inner
-cd inner
-hg up B
-echo b1 >b1
-hg ci -Amb1
+
+  $ hg clone . inner
+  updating to branch B
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd inner
+  $ hg up B
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b1 >b1
+  $ hg ci -Amb1
+  adding b1
+
 # in the clone b1 is now the head of B
-cd ..
-hg up 0
-echo a2 >a2
-hg ci -Ama2
+
+  $ cd ..
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo a2 >a2
+  $ hg ci -Ama2
+  adding a2
+
 # a2 is now the new branch head of A, and a new topological head
 # it replaces a former inner branch head, so it should at most warn about A, not B
-echo %% glog of local
-hg glog --template "{rev}: {branches} {desc}\n"
-echo %% glog of remote
-hg glog -R inner --template "{rev}: {branches} {desc}\n"
-echo %% outgoing
-hg out inner --template "{rev}: {branches} {desc}\n"
-hg push inner
-cd ..
 
-echo % check prepush with new branch head on former topo head
-hg init o
-cd o
-hg branch A
-echo a >a
-hg ci -Ama
-hg branch B
-echo b >b
-hg ci -Amb
+glog of local:
+
+  $ hg glog --template "{rev}: {branches} {desc}\n"
+  @  2: A a2
+  |
+  | o  1: B b
+  |/
+  o  0: A a
+  
+glog of remote:
+
+  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  @  2: B b1
+  |
+  o  1: B b
+  |
+  o  0: A a
+  
+outgoing:
+
+  $ hg out inner --template "{rev}: {branches} {desc}\n"
+  comparing with inner
+  searching for changes
+  2: A a2
+
+  $ hg push inner
+  pushing to inner
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+
+  $ cd ..
+
+
+Check prepush with new branch head on former topo head:
+
+  $ hg init o
+  $ cd o
+  $ hg branch A
+  marked working directory as branch A
+  $ echo a >a
+  $ hg ci -Ama
+  adding a
+  $ hg branch B
+  marked working directory as branch B
+  $ echo b >b
+  $ hg ci -Amb
+  adding b
+
 # b is now branch head of B, and a topological head
-hg up 0
-echo a1 >a1
-hg ci -Ama1
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo a1 >a1
+  $ hg ci -Ama1
+  adding a1
+
 # a1 is now branch head of A, and a topological head
-hg clone . inner
-cd inner
-hg up B
-echo b1 >b1
-hg ci -Amb1
+
+  $ hg clone . inner
+  updating to branch A
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd inner
+  $ hg up B
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo b1 >b1
+  $ hg ci -Amb1
+  adding b1
+
 # in the clone b1 is now the head of B
-cd ..
-echo a2 >a2
-hg ci -Ama2
+
+  $ cd ..
+  $ echo a2 >a2
+  $ hg ci -Ama2
+  adding a2
+
 # a2 is now the new branch head of A, and a topological head
 # it replaces a former topological and branch head, so this should not warn
-echo %% glog of local
-hg glog --template "{rev}: {branches} {desc}\n"
-echo %% glog of remote
-hg glog -R inner --template "{rev}: {branches} {desc}\n"
-echo %% outgoing
-hg out inner --template "{rev}: {branches} {desc}\n"
-hg push inner
-cd ..
 
-echo % check prepush with new branch head and new child of former branch head
-echo % but child is on different branch
-hg init p
-cd p
-hg branch A
-echo a0 >a
-hg ci -Ama0
-echo a1 >a
-hg ci -ma1
-hg up null
-hg branch B
-echo b0 >b
-hg ci -Amb0
-echo b1 >b
-hg ci -mb1
+glog of local:
 
-hg clone . inner
+  $ hg glog --template "{rev}: {branches} {desc}\n"
+  @  3: A a2
+  |
+  o  2: A a1
+  |
+  | o  1: B b
+  |/
+  o  0: A a
+  
+glog of remote:
 
-hg up A
-hg branch -f B
-echo a3 >a
-hg ci -ma3
-hg up 3
-hg branch -f A
-echo b3 >b
-hg ci -mb3
+  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  @  3: B b1
+  |
+  | o  2: A a1
+  | |
+  o |  1: B b
+  |/
+  o  0: A a
+  
+outgoing:
 
-echo %% glog of local
-hg glog --template "{rev}: {branches} {desc}\n"
-echo %% glog of remote
-hg glog -R inner --template "{rev}: {branches} {desc}\n"
-echo %% outgoing
-hg out inner --template "{rev}: {branches} {desc}\n"
-hg push inner
-hg push inner -r4 -r5
-hg in inner
-cd ..
+  $ hg out inner --template "{rev}: {branches} {desc}\n"
+  comparing with inner
+  searching for changes
+  3: A a2
 
-exit 0
+  $ hg push inner
+  pushing to inner
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+  $ cd ..
+
+
+Check prepush with new branch head and new child of former branch head
+but child is on different branch:
+
+  $ hg init p
+  $ cd p
+  $ hg branch A
+  marked working directory as branch A
+  $ echo a0 >a
+  $ hg ci -Ama0
+  adding a
+  $ echo a1 >a
+  $ hg ci -ma1
+  $ hg up null
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch B
+  marked working directory as branch B
+  $ echo b0 >b
+  $ hg ci -Amb0
+  adding b
+  $ echo b1 >b
+  $ hg ci -mb1
+
+  $ hg clone . inner
+  updating to branch B
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg up A
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch -f B
+  marked working directory as branch B
+  $ echo a3 >a
+  $ hg ci -ma3
+  created new head
+  $ hg up 3
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch -f A
+  marked working directory as branch A
+  $ echo b3 >b
+  $ hg ci -mb3
+  created new head
+
+glog of local:
+
+  $ hg glog --template "{rev}: {branches} {desc}\n"
+  @  5: A b3
+  |
+  | o  4: B a3
+  | |
+  o |  3: B b1
+  | |
+  o |  2: B b0
+   /
+  o  1: A a1
+  |
+  o  0: A a0
+  
+glog of remote:
+
+  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  @  3: B b1
+  |
+  o  2: B b0
+  
+  o  1: A a1
+  |
+  o  0: A a0
+  
+outgoing:
+
+  $ hg out inner --template "{rev}: {branches} {desc}\n"
+  comparing with inner
+  searching for changes
+  4: B a3
+  5: A b3
+
+  $ hg push inner
+  pushing to inner
+  searching for changes
+  abort: push creates new remote heads on branch 'A'!
+  (did you forget to merge? use push -f to force)
+
+  $ hg push inner -r4 -r5
+  pushing to inner
+  searching for changes
+  abort: push creates new remote heads on branch 'A'!
+  (did you forget to merge? use push -f to force)
+
+  $ hg in inner
+  comparing with inner
+  searching for changes
+  no changes found
+
+  $ cd ..
+


More information about the Mercurial-devel mailing list