Mercurial > hg-stable
changeset 12969:6bd9778ae749 stable
pushkey: force HTTP POST on push and add tests (issue2489)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 12 Nov 2010 01:21:45 -0600 |
parents | 70b043405400 |
children | 91cbba199d8b 15390d1a3cfc 062ae1aeb84d |
files | mercurial/httprepo.py tests/test-bookmarks-pushpull.t tests/test-ssh.t |
diffstat | 3 files changed, 182 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/httprepo.py Wed Nov 10 17:28:24 2010 +0100 +++ b/mercurial/httprepo.py Fri Nov 12 01:21:45 2010 -0600 @@ -68,6 +68,8 @@ raise util.Abort(_('operation not supported over http')) def _callstream(self, cmd, **args): + if cmd is 'pushkey': + args['data'] = '' data = args.pop('data', None) headers = args.pop('headers', {}) self.ui.debug("sending %s command\n" % cmd)
--- a/tests/test-bookmarks-pushpull.t Wed Nov 10 17:28:24 2010 +0100 +++ b/tests/test-bookmarks-pushpull.t Fri Nov 12 01:21:45 2010 -0600 @@ -22,6 +22,9 @@ $ hg init ../b $ cd ../b + $ hg book Y + $ hg book + * Y -1:000000000000 $ hg pull ../a pulling from ../a requesting all changes @@ -31,13 +34,21 @@ added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) $ hg bookmarks - no bookmarks set + Y 0:4e3505fd9583 + $ hg debugpushkey ../a namespaces + bookmarks + namespaces + $ hg debugpushkey ../a bookmarks + Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 + X 4e3505fd95835d721066b76e75dbb8cc554d7f77 + Z 4e3505fd95835d721066b76e75dbb8cc554d7f77 $ hg pull -B X ../a pulling from ../a searching for changes no changes found importing bookmark X $ hg bookmark + Y 0:4e3505fd9583 X 0:4e3505fd9583 export bookmark by name @@ -56,6 +67,12 @@ * Z 0:4e3505fd9583 W -1:000000000000 +delete a remote bookmark + + $ hg book -d W + $ hg push -B W ../a + deleting remote bookmark W + push/pull name that doesn't exist $ hg push -B badname ../a @@ -64,3 +81,99 @@ $ hg pull -B anotherbadname ../a abort: remote bookmark anotherbadname not found! [255] + +divergent bookmarks + + $ cd ../a + $ echo c1 > f1 + $ hg ci -Am1 + adding f1 + $ hg book -f X + $ hg book + Y 0:4e3505fd9583 + * X 1:0d2164f0ce0d + Z 1:0d2164f0ce0d + + $ cd ../b + $ hg up + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo c2 > f2 + $ hg ci -Am2 + adding f2 + $ hg book -f X + $ hg book + Y 0:4e3505fd9583 + * X 1:9b140be10808 + foo -1:000000000000 + foobar -1:000000000000 + + $ 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) + not updating divergent bookmark X + (run 'hg heads' to see heads, 'hg merge' to merge) + $ hg book + Y 0:4e3505fd9583 + * X 1:9b140be10808 + foo -1:000000000000 + foobar -1:000000000000 + $ hg push -f ../a + pushing to ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads) + $ hg -R ../a book + Y 0:4e3505fd9583 + * X 1:0d2164f0ce0d + Z 1:0d2164f0ce0d + +hgweb + + $ cat <<EOF > .hg/hgrc + > [web] + > push_ssl = false + > allow_push = * + > EOF + + $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log + $ cat ../hg.pid >> $DAEMON_PIDS + $ cd ../a + + $ hg debugpushkey http://localhost:$HGPORT/ namespaces + bookmarks + namespaces + $ hg debugpushkey http://localhost:$HGPORT/ bookmarks + Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 + X 9b140be1080824d768c5a4691a564088eede71f9 + foo 0000000000000000000000000000000000000000 + foobar 0000000000000000000000000000000000000000 + $ hg out -B http://localhost:$HGPORT/ + comparing with http://localhost:$HGPORT/ + searching for changed bookmarks + Z 0d2164f0ce0d + $ hg push -B Z http://localhost:$HGPORT/ + pushing to http://localhost:$HGPORT/ + searching for changes + no changes found + exporting bookmark Z + $ hg book -d Z + $ hg in -B http://localhost:$HGPORT/ + comparing with http://localhost:$HGPORT/ + searching for changed bookmarks + Z 0d2164f0ce0d + foo 000000000000 + foobar 000000000000 + $ hg pull -B Z http://localhost:$HGPORT/ + pulling from http://localhost:$HGPORT/ + searching for changes + no changes found + not updating divergent bookmark X + importing bookmark Z + + $ kill `cat ../hg.pid`
--- a/tests/test-ssh.t Wed Nov 10 17:28:24 2010 +0100 +++ b/tests/test-ssh.t Fri Nov 12 01:21:45 2010 -0600 @@ -37,10 +37,16 @@ $ echo this > foo $ echo this > fooO $ hg ci -A -m "init" foo fooO - $ echo '[server]' > .hg/hgrc - $ echo 'uncompressed = True' >> .hg/hgrc - $ echo '[hooks]' >> .hg/hgrc - $ echo 'changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog' >> .hg/hgrc + $ echo <<EOF > .hg/hgrc + > [server] + > uncompressed = True + > + > [extensions] + > bookmarks = + > + > [hooks] + > changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog + > EOF $ cd .. repo not found error @@ -116,6 +122,8 @@ $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc $ echo "[ui]" >> .hg/hgrc $ echo "ssh = python ../dummyssh" >> .hg/hgrc + $ echo '[extensions]' >> .hg/hgrc + $ echo 'bookmarks =' >> .hg/hgrc find outgoing @@ -185,10 +193,52 @@ $ hg ci -A -m z z created new head +test pushkeys and bookmarks + + $ cd ../local + $ echo '[extensions]' >> ../remote/.hg/hgrc + $ echo 'bookmarks =' >> ../remote/.hg/hgrc + $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces + bookmarks + namespaces + $ hg book foo -r 0 + $ hg out -B + comparing with ssh://user@dummy/remote + searching for changed bookmarks + foo 1160648e36ce + $ hg push -B foo + pushing to ssh://user@dummy/remote + searching for changes + no changes found + exporting bookmark foo + $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks + foo 1160648e36cec0054048a7edc4110c6f84fde594 + $ hg book -f foo + $ hg push + pushing to ssh://user@dummy/remote + searching for changes + no changes found + updating bookmark foo + $ hg book -d foo + $ hg in -B + comparing with ssh://user@dummy/remote + searching for changed bookmarks + foo a28a9d1a809c + $ hg book -f -r 0 foo + $ hg pull -B foo + pulling from ssh://user@dummy/remote + searching for changes + no changes found + updating bookmark foo + importing bookmark foo + $ hg book -d foo + $ hg push -B foo + deleting remote bookmark foo + a bad, evil hook that prints to stdout - $ echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc - $ cd ../local + $ echo '[hooks]' >> ../remote/.hg/hgrc + $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc $ echo r > r $ hg ci -A -m z r @@ -228,6 +278,14 @@ Got arguments 1:user@dummy 2:hg -R local serve --stdio Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R remote serve --stdio