summaryrefslogtreecommitdiff
path: root/contrib/remote-helpers
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-05-25 02:29:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-05-28 15:02:03 (GMT)
commitd2c76330286c8bd604f9fbbb7818cecce893b769 (patch)
tree163989d0f8368fa1c1e2f52547eb6ff7e163ed1b /contrib/remote-helpers
parentad22b92a810bd793e4a357d0230beefb865e929e (diff)
downloadgit-d2c76330286c8bd604f9fbbb7818cecce893b769.zip
git-d2c76330286c8bd604f9fbbb7818cecce893b769.tar.gz
git-d2c76330286c8bd604f9fbbb7818cecce893b769.tar.bz2
remote-hg: add test for big push
With lots branches and bookmarks, non-ff, updated and new. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers')
-rwxr-xr-xcontrib/remote-helpers/test-hg.sh113
1 files changed, 107 insertions, 6 deletions
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 7a6e5da..66e37af 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -27,15 +27,25 @@ check () {
}
check_branch () {
- echo $3 > expected &&
- hg -R $1 log -r $2 --template '{desc}\n' > actual &&
- test_cmp expected actual
+ if [ -n "$3" ]; then
+ echo $3 > expected &&
+ hg -R $1 log -r $2 --template '{desc}\n' > actual &&
+ test_cmp expected actual
+ else
+ hg -R $1 branches > out &&
+ ! grep $2 out
+ fi
}
check_bookmark () {
- echo $3 > expected &&
- hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' > actual &&
- test_cmp expected actual
+ if [ -n "$3" ]; then
+ echo $3 > expected &&
+ hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' > actual &&
+ test_cmp expected actual
+ else
+ hg -R $1 bookmarks > out &&
+ ! grep $2 out
+ fi
}
setup () {
@@ -385,4 +395,95 @@ test_expect_failure 'remote new bookmark multiple branch head' '
check_bookmark hgrepo feature-c feature-c
'
+# cleanup previous stuff
+rm -rf hgrepo
+
+test_expect_failure 'remote big push' '
+ test_when_finished "rm -rf hgrepo gitrepo*" &&
+
+ (
+ hg init hgrepo &&
+ cd hgrepo &&
+ echo zero > content &&
+ hg add content &&
+ hg commit -m zero &&
+ hg bookmark bad_bmark1 &&
+ echo one > content &&
+ hg commit -m one &&
+ hg bookmark bad_bmark2 &&
+ hg bookmark good_bmark &&
+ hg bookmark -i good_bmark &&
+ hg -q branch good_branch &&
+ echo "good branch" > content &&
+ hg commit -m "good branch" &&
+ hg -q branch bad_branch &&
+ echo "bad branch" > content &&
+ hg commit -m "bad branch"
+ ) &&
+
+ git clone "hg::hgrepo" gitrepo &&
+
+ (
+ cd gitrepo &&
+ echo two > content &&
+ git commit -q -a -m two &&
+
+ git checkout -q good_bmark &&
+ echo three > content &&
+ git commit -q -a -m three &&
+
+ git checkout -q bad_bmark1 &&
+ git reset --hard HEAD^ &&
+ echo four > content &&
+ git commit -q -a -m four &&
+
+ git checkout -q bad_bmark2 &&
+ git reset --hard HEAD^ &&
+ echo five > content &&
+ git commit -q -a -m five &&
+
+ git checkout -q -b new_bmark master &&
+ echo six > content &&
+ git commit -q -a -m six &&
+
+ git checkout -q branches/good_branch &&
+ echo seven > content &&
+ git commit -q -a -m seven &&
+ echo eight > content &&
+ git commit -q -a -m eight &&
+
+ git checkout -q branches/bad_branch &&
+ git reset --hard HEAD^ &&
+ echo nine > content &&
+ git commit -q -a -m nine &&
+
+ git checkout -q -b branches/new_branch master &&
+ echo ten > content &&
+ git commit -q -a -m ten &&
+
+ test_expect_code 1 git push origin master \
+ good_bmark bad_bmark1 bad_bmark2 new_bmark \
+ branches/good_branch branches/bad_branch \
+ branches/new_branch 2> error &&
+
+ grep "^ [a-f0-9]*\.\.[a-f0-9]* *master -> master$" error &&
+ grep "^ [a-f0-9]*\.\.[a-f0-9]* *good_bmark -> good_bmark$" error &&
+ grep "^ \* \[new branch\] *new_bmark -> new_bmark$" error &&
+ grep "^ ! \[rejected\] *bad_bmark2 -> bad_bmark2 (non-fast-forward)$" error &&
+ grep "^ ! \[rejected\] *bad_bmark1 -> bad_bmark1 (non-fast-forward)$" error &&
+ grep "^ [a-f0-9]*\.\.[a-f0-9]* *branches/good_branch -> branches/good_branch$" error &&
+ grep "^ ! \[rejected\] *branches/bad_branch -> branches/bad_branch (non-fast-forward)$" error &&
+ grep "^ \* \[new branch\] *branches/new_branch -> branches/new_branch$" error
+ ) &&
+
+ check_branch hgrepo default one &&
+ check_branch hgrepo good_branch "good branch" &&
+ check_branch hgrepo bad_branch "bad branch" &&
+ check_branch hgrepo new_branch '' &&
+ check_bookmark hgrepo good_bmark one &&
+ check_bookmark hgrepo bad_bmark1 one &&
+ check_bookmark hgrepo bad_bmark2 one &&
+ check_bookmark hgrepo new_bmark ''
+'
+
test_done