tests/test-static-http
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 5314 598dae804a5f
child 5384 e3a0c092b4e2
permissions -rwxr-xr-x
convert: add a mode where mercurial_sink skips empty revisions. The getchanges function of some converter_source classes can return some false positives. I.e. they sometimes claim that a file "foo" was changed in some revision, even though its contents are still the same. convert_svn is particularly bad, but I think this can also happen with convert_cvs and, at least in theory, with mercurial_source. For regular conversions this is not really a problem - as long as getfile returns the right contents, we'll get a converted revision with the right contents. But when we use --filemap, this could lead to superfluous revisions being converted. Instead of fixing every converter_source, I decided to change mercurial_sink to work around this problem. When --filemap is used, we're interested only in revisions that touch some specific files. If a revision doesn't change any of these files, then we're not interested in it (at least for revisions with a single parent; merges are special). For mercurial_sink, we abuse this property and rollback a commit if the manifest text hasn't changed. This avoids duplicating the logic from localrepo.filecommit to detect unchanged files.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     1
#!/bin/sh
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     2
4290
347766c2ff86 test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3464
diff changeset
     3
cp "$TESTDIR"/printenv.py .
347766c2ff86 test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3464
diff changeset
     4
2431
d90a9d7c7d4d replace old-http:// syntax by static-http:// and deprecate the redundant hg://
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1962
diff changeset
     5
http_proxy= hg clone static-http://localhost:20059/ copy
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     6
echo $?
3464
33b6c8193652 Don't use test -e in tests - sh doesn't like it on Solaris
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3418
diff changeset
     7
test -d copy || echo copy: No such file or directory
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     8
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
     9
# This server doesn't do range requests so it's basically only good for
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    10
# one pull
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    11
cat > dumb.py <<EOF
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    12
import BaseHTTPServer, SimpleHTTPServer, signal
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    13
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    14
def run(server_class=BaseHTTPServer.HTTPServer,
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    15
        handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    16
    server_address = ('localhost', 20059)
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    17
    httpd = server_class(server_address, handler_class)
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    18
    httpd.serve_forever()
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    19
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    20
signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    21
run()
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    22
EOF
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    23
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    24
python dumb.py 2>/dev/null &
2571
d22d730c96ed tests: record few more daemon pids to be safe
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2431
diff changeset
    25
echo $! >> $DAEMON_PIDS
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    26
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    27
mkdir remote
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    28
cd remote
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    29
hg init
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    30
echo foo > bar
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    31
hg add bar
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1923
diff changeset
    32
hg commit -m"test" -d "1000000 0"
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    33
hg tip
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    34
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    35
cd ..
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    36
2431
d90a9d7c7d4d replace old-http:// syntax by static-http:// and deprecate the redundant hg://
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1962
diff changeset
    37
http_proxy= hg clone static-http://localhost:20059/remote local
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    38
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    39
cd local
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    40
hg verify
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    41
cat bar
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    42
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    43
cd ../remote
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    44
echo baz > quux
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    45
hg commit -A -mtest2 -d '100000000 0'
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    46
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    47
cd ../local
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2571
diff changeset
    48
echo '[hooks]' >> .hg/hgrc
4290
347766c2ff86 test-static-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3464
diff changeset
    49
echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
1502
1170fef58071 Fixed test-static-http with http_proxy variable set again.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1128
diff changeset
    50
http_proxy= hg pull
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    51
5314
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    52
echo '% test with "/" URI (issue 747)'
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    53
cd ..
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    54
hg init
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    55
echo a > a
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    56
hg add a
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    57
hg ci -ma
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    58
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    59
http_proxy= hg clone static-http://localhost:20059/ local2
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    60
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    61
cd local2
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    62
hg verify
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    63
cat a
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    64
hg paths
598dae804a5f Test static-http calls on '/' URI (issue 747)
Patrick Mezard <pmezard@gmail.com>
parents: 4290
diff changeset
    65
1111
addcb77fe500 Add an old-http test case
mpm@selenic.com
parents:
diff changeset
    66
kill $!