# HG changeset patch # User Sune Foldager # Date 1243091081 -7200 # Node ID 268d16b2ec2562918119f5bc42f0996819954229 # Parent 6b9ec23b09fcf3436df14826137adb9ff5284dbe tests: add tests for new pre-push logic (issue736) Co-contributor: Henrik Stuart diff -r 6b9ec23b09fc -r 268d16b2ec25 tests/test-push-warn --- a/tests/test-push-warn Sat May 23 17:04:31 2009 +0200 +++ b/tests/test-push-warn Sat May 23 17:04:41 2009 +0200 @@ -59,4 +59,68 @@ hg push -r 0 ../e ; echo $? hg push -r 1 ../e ; echo $? +cd .. + +# issue 736 +echo % issue 736 +hg init f +cd f +hg -q branch a +echo 0 > foo +hg -q ci -d "1000000 0" -Am 0 +echo 1 > foo +hg -q ci -d "1000000 0" -m 1 +hg -q up 0 +echo 2 > foo +hg -q ci -d "1000000 0" -m 2 +hg -q up 0 +hg -q branch b +echo 3 > foo +hg -q ci -d "1000000 0" -m 3 +cd .. + +hg -q clone f g +cd g + +echo % push on existing branch and new branch +hg -q up 1 +echo 4 > foo +hg -q ci -d "1000000 0" -m 4 +hg -q up 0 +echo 5 > foo +hg -q branch c +hg -q ci -d "1000000 0" -m 5 +hg push -r 4 -r 5 ../f; echo $? + +echo % fail on multiple head push +hg -q up 1 +echo 6 > foo +hg -q ci -d "1000000 0" -m 6 +hg push -r 4 -r 6 ../f; echo $? + +echo % push replacement head on existing branches +hg -q up 3 +echo 7 > foo +hg -q ci -d "1000000 0" -m 7 +hg push -r 6 -r 7 ../f; echo $? + +echo % merge of branch a to other branch b followed by unrelated push on branch a +hg -q up 6 +HGMERGE=true hg -q merge 7 +hg -q ci -d "1000000 0" -m 8 +hg -q up 7 +echo 9 > foo +hg -q ci -d "1000000 0" -m 9 +hg push -r 8 ../f; echo $? +hg push -r 9 ../f; echo $? + +echo % cheating the counting algorithm +hg -q up 8 +HGMERGE=true hg -q merge 2 +hg -q ci -d "1000000 0" -m 10 +hg -q up 1 +echo 11 > foo +hg -q ci -d "1000000 0" -m 11 +hg push -r 10 -r 11 ../f; echo $? + exit 0 diff -r 6b9ec23b09fc -r 268d16b2ec25 tests/test-push-warn.out --- a/tests/test-push-warn.out Sat May 23 17:04:31 2009 +0200 +++ b/tests/test-push-warn.out Sat May 23 17:04:41 2009 +0200 @@ -80,3 +80,47 @@ 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 branch 'c'! +(did you forget to merge? use push -f to force) +1 +% fail on multiple head push +pushing to ../f +searching for changes +abort: push creates new remote heads! +(did you forget to merge? use push -f to force) +1 +% 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