test-static-http.t
191 lines
| 5.0 KiB
| text/troff
|
Tads3Lexer
/ tests / test-static-http.t
Matt Mackall
|
r22046 | #require killdaemons | ||
Matt Mackall
|
r12491 | |||
Adrian Buehlmann
|
r17020 | #if windows | ||
$ hg clone http://localhost:$HGPORT/ copy | ||||
abort: * (glob) | ||||
[255] | ||||
#else | ||||
Matt Mackall
|
r12491 | $ hg clone http://localhost:$HGPORT/ copy | ||
abort: error: Connection refused | ||||
[255] | ||||
Adrian Buehlmann
|
r17020 | #endif | ||
Matt Mackall
|
r12491 | $ test -d copy | ||
[1] | ||||
This server doesn't do range requests so it's basically only good for | ||||
one pull | ||||
$ cat > dumb.py <<EOF | ||||
Adrian Buehlmann
|
r13208 | > import BaseHTTPServer, SimpleHTTPServer, os, signal, sys | ||
Matt Mackall
|
r12491 | > | ||
> def run(server_class=BaseHTTPServer.HTTPServer, | ||||
> handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): | ||||
> server_address = ('localhost', int(os.environ['HGPORT'])) | ||||
> httpd = server_class(server_address, handler_class) | ||||
> httpd.serve_forever() | ||||
> | ||||
Adrian Buehlmann
|
r13208 | > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0)) | ||
Patrick Mezard
|
r17538 | > fp = file('dumb.pid', 'wb') | ||
> fp.write(str(os.getpid()) + '\n') | ||||
> fp.close() | ||||
Matt Mackall
|
r12491 | > run() | ||
> EOF | ||||
$ python dumb.py 2>/dev/null & | ||||
Patrick Mezard
|
r17538 | |||
Cannot just read $!, it will not be set to the right value on Windows/MinGW | ||||
$ cat > wait.py <<EOF | ||||
> import time | ||||
> while True: | ||||
> try: | ||||
> if '\n' in file('dumb.pid', 'rb').read(): | ||||
> break | ||||
> except IOError: | ||||
> pass | ||||
> time.sleep(0.2) | ||||
> EOF | ||||
$ python wait.py | ||||
$ cat dumb.pid >> $DAEMON_PIDS | ||||
Martin Geisler
|
r13956 | $ hg init remote | ||
Matt Mackall
|
r12491 | $ cd remote | ||
$ echo foo > bar | ||||
Adrian Buehlmann
|
r13209 | $ echo c2 > '.dotfile with spaces' | ||
$ hg add | ||||
adding .dotfile with spaces | ||||
adding bar | ||||
Matt Mackall
|
r12491 | $ hg commit -m"test" | ||
$ hg tip | ||||
Adrian Buehlmann
|
r13209 | changeset: 0:02770d679fb8 | ||
Matt Mackall
|
r12491 | tag: tip | ||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: test | ||||
$ cd .. | ||||
$ hg clone static-http://localhost:$HGPORT/remote local | ||||
requesting all changes | ||||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
Adrian Buehlmann
|
r13209 | added 1 changesets with 2 changes to 2 files | ||
Matt Mackall
|
r12491 | updating to branch default | ||
Adrian Buehlmann
|
r13209 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
Matt Mackall
|
r12491 | $ cd local | ||
$ hg verify | ||||
checking changesets | ||||
checking manifests | ||||
crosschecking files in changesets and manifests | ||||
checking files | ||||
Adrian Buehlmann
|
r13209 | 2 files, 1 changesets, 2 total revisions | ||
Matt Mackall
|
r12491 | $ cat bar | ||
foo | ||||
$ cd ../remote | ||||
$ echo baz > quux | ||||
$ hg commit -A -mtest2 | ||||
adding quux | ||||
check for HTTP opener failures when cachefile does not exist | ||||
jfh
|
r13272 | $ rm .hg/cache/* | ||
Matt Mackall
|
r12491 | $ cd ../local | ||
$ echo '[hooks]' >> .hg/hgrc | ||||
Mads Kiilerich
|
r17018 | $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup" >> .hg/hgrc | ||
Matt Mackall
|
r12491 | $ hg pull | ||
Mads Kiilerich
|
r12643 | pulling from static-http://localhost:$HGPORT/remote | ||
Matt Mackall
|
r12491 | searching for changes | ||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
added 1 changesets with 1 changes to 1 files | ||||
Adrian Buehlmann
|
r16982 | changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote | ||
Matt Mackall
|
r12491 | (run 'hg update' to get a working copy) | ||
trying to push | ||||
$ hg update | ||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ echo more foo >> bar | ||||
$ hg commit -m"test" | ||||
$ hg push | ||||
Mads Kiilerich
|
r12643 | pushing to static-http://localhost:$HGPORT/remote | ||
Sune Foldager
|
r17193 | abort: destination does not support push | ||
Matt Mackall
|
r12491 | [255] | ||
trying clone -r | ||||
$ cd .. | ||||
timeless@mozdev.org
|
r17486 | $ hg clone -r doesnotexist static-http://localhost:$HGPORT/remote local0 | ||
abort: unknown revision 'doesnotexist'! | ||||
Matt Mackall
|
r12491 | [255] | ||
$ hg clone -r 0 static-http://localhost:$HGPORT/remote local0 | ||||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
Adrian Buehlmann
|
r13209 | added 1 changesets with 2 changes to 2 files | ||
Matt Mackall
|
r12491 | updating to branch default | ||
Adrian Buehlmann
|
r13209 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
Matt Mackall
|
r12491 | |||
Matt Mackall
|
r22183 | test with "/" URI (issue747) and subrepo | ||
Matt Mackall
|
r12491 | |||
$ hg init | ||||
Mads Kiilerich
|
r13440 | $ hg init sub | ||
Brad Hall
|
r17260 | $ touch sub/test | ||
$ hg -R sub commit -A -m "test" | ||||
adding test | ||||
Mads Kiilerich
|
r13440 | $ hg -R sub tag not-empty | ||
$ echo sub=sub > .hgsub | ||||
Matt Mackall
|
r12491 | $ echo a > a | ||
Mads Kiilerich
|
r13440 | $ hg add a .hgsub | ||
$ hg -q ci -ma | ||||
Matt Mackall
|
r12491 | $ hg clone static-http://localhost:$HGPORT/ local2 | ||
requesting all changes | ||||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
Mads Kiilerich
|
r13440 | added 1 changesets with 3 changes to 3 files | ||
Matt Mackall
|
r12491 | updating to branch default | ||
Martin Geisler
|
r14281 | cloning subrepo sub from static-http://localhost:$HGPORT/sub | ||
Mads Kiilerich
|
r13440 | requesting all changes | ||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
Brad Hall
|
r17260 | added 2 changesets with 2 changes to 2 files | ||
Mads Kiilerich
|
r13440 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
Matt Mackall
|
r12491 | $ cd local2 | ||
$ hg verify | ||||
checking changesets | ||||
checking manifests | ||||
crosschecking files in changesets and manifests | ||||
checking files | ||||
Mads Kiilerich
|
r13440 | 3 files, 1 changesets, 3 total revisions | ||
Matt Mackall
|
r12491 | $ cat a | ||
a | ||||
$ hg paths | ||||
Mads Kiilerich
|
r12643 | default = static-http://localhost:$HGPORT/ | ||
Matt Mackall
|
r12491 | |||
test with empty repo (issue965) | ||||
$ cd .. | ||||
$ hg init remotempty | ||||
$ hg clone static-http://localhost:$HGPORT/remotempty local3 | ||||
no changes found | ||||
updating to branch default | ||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ cd local3 | ||||
$ hg verify | ||||
checking changesets | ||||
checking manifests | ||||
crosschecking files in changesets and manifests | ||||
checking files | ||||
0 files, 0 changesets, 0 total revisions | ||||
$ hg paths | ||||
Mads Kiilerich
|
r12643 | default = static-http://localhost:$HGPORT/remotempty | ||
Matt Mackall
|
r12491 | |||
test with non-repo | ||||
$ cd .. | ||||
$ mkdir notarepo | ||||
$ hg clone static-http://localhost:$HGPORT/notarepo local3 | ||||
Mads Kiilerich
|
r12643 | abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository! | ||
Matt Mackall
|
r12491 | [255] | ||
Patrick Mezard
|
r17538 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | ||