changeset 13946:3c2f9f611ef6

tests: new test cases for the unbundlehash capability
author Steven Brown <StevenGBrown@gmail.com>
date Sun, 17 Apr 2011 02:15:47 +0800
parents 03f3ce7ca2a8
children d2d1ef6a5238
files tests/test-push-cgi.t tests/test-push-http.t
diffstat 2 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-push-cgi.t	Fri Apr 15 16:15:32 2011 +0200
+++ b/tests/test-push-cgi.t	Sun Apr 17 02:15:47 2011 +0800
@@ -59,7 +59,7 @@
   adding file changes
   added 0 changesets with 0 changes to 1 files
 
-successful push
+successful push, list of heads
 
   $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING
   $ python hgweb.cgi <bundle.hg >page3 2>&1
@@ -72,3 +72,17 @@
   adding manifests
   adding file changes
   added 0 changesets with 0 changes to 1 files
+
+successful push, SHA1 hash of heads (unbundlehash capability)
+
+  $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING
+  $ python hgweb.cgi <bundle.hg >page4 2>&1
+  $ cat page4
+  Status: 200 Script output follows\r (esc)
+  Content-Type: application/mercurial-0.1\r (esc)
+  \r (esc)
+  1
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 0 changes to 1 files
--- a/tests/test-push-http.t	Fri Apr 15 16:15:32 2011 +0200
+++ b/tests/test-push-http.t	Sun Apr 17 02:15:47 2011 +0800
@@ -66,6 +66,32 @@
   repository tip rolled back to revision 0 (undo serve)
   working directory now based on revision 0
 
+expect success, server lacks the unbundlehash capability
+
+  $ cat > unbundlehash-off.py << EOF
+  > from mercurial import extensions, repo
+  > def extsetup():
+  >     extensions.wrapfunction(repo.repository, 'capable', wrapper)
+  > def wrapper(orig, self, name, *args, **kwargs):
+  >     if name == 'unbundlehash':
+  >         return False
+  >     return orig(self, name, *args, **kwargs)
+  > EOF
+  $ echo '[extensions]' >> .hg/hgrc
+  $ echo "unbundlehash-off = `pwd`/unbundlehash-off.py" >> .hg/hgrc
+  $ req
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+  remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*:  (glob)
+  % serve errors
+  $ hg rollback
+  repository tip rolled back to revision 0 (undo serve)
+  working directory now based on revision 0
+
 expect authorization error: all users denied
 
   $ echo '[web]' > .hg/hgrc