tests/test-http
author David Greenaway <hg-dev@davidgreenaway.com>
Sat, 03 Apr 2010 11:58:16 +1100
changeset 11060 e6df01776e08
parent 10414 1a8df80dfdde
permissions -rwxr-xr-x
findrenames: Optimise "addremove -s100" by matching files by their SHA1 hashes. We speed up 'findrenames' for the usecase when a user specifies they want a similarity of 100% by matching files by their exact SHA1 hash value. This reduces the number of comparisons required to find exact matches from O(n^2) to O(n). While it would be nice if we could just use mercurial's pre-calculated SHA1 hash for existing files, this hash includes the file's ancestor information making it unsuitable for our purposes. Instead, we calculate the hash of old content from scratch. The following benchmarks were taken on the current head of crew: addremove 100% similarity: rm -rf *; hg up -C; mv tests tests.new hg --time addremove -s100 --dry-run before: real 176.350 secs (user 128.890+0.000 sys 47.430+0.000) after: real 2.130 secs (user 1.890+0.000 sys 0.240+0.000) addremove 75% similarity: rm -rf *; hg up -C; mv tests tests.new; \ for i in tests.new/*; do echo x >> $i; done hg --time addremove -s75 --dry-run before: real 264.560 secs (user 215.130+0.000 sys 49.410+0.000) after: real 218.710 secs (user 172.790+0.000 sys 45.870+0.000)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
4289
e17598881509 test-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4130
diff changeset
     3
cp "$TESTDIR"/printenv.py .
e17598881509 test-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4130
diff changeset
     4
2621
5a5852a417b1 clone: disable stream support on server side by default.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2613
diff changeset
     5
hg init test
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     6
cd test
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     7
echo foo>foo
9506
49b62395e910 streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents: 8167
diff changeset
     8
mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
49b62395e910 streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents: 8167
diff changeset
     9
echo foo>foo.d/foo
49b62395e910 streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents: 8167
diff changeset
    10
echo bar>foo.d/bAr.hg.d/BaR
49b62395e910 streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents: 8167
diff changeset
    11
echo bar>foo.d/baR.d.hg/bAR
49b62395e910 streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents: 8167
diff changeset
    12
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 6263
diff changeset
    13
hg commit -A -m 1
10414
1a8df80dfdde streaming: actually change default
Matt Mackall <mpm@selenic.com>
parents: 10398
diff changeset
    14
hg serve -p $HGPORT -d --pid-file=../hg1.pid
1a8df80dfdde streaming: actually change default
Matt Mackall <mpm@selenic.com>
parents: 10398
diff changeset
    15
hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
4130
178007785be8 web/server: disable address reuse option for BaseHTTPServer on windows
Patrick Mezard <pmezard@gmail.com>
parents: 3015
diff changeset
    16
# Test server address cannot be reused
10398
ace3cf2bc991 tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents: 10154
diff changeset
    17
hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':\$HGPORT1':/"
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    18
cd ..
2676
7c81e337fed2 Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2673
diff changeset
    19
cat hg1.pid hg2.pid >> $DAEMON_PIDS
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    21
echo % clone via stream
10154
d4a62b6d4a58 run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 9506
diff changeset
    22
hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \
3015
fa4229c60dd7 Allow for MB/sec transfer rates in test-http-proxy and test-ssh.
Lee Cantey <lcantey@gmail.com>
parents: 2986
diff changeset
    23
  sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
2676
7c81e337fed2 Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2673
diff changeset
    24
hg verify -R copy
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    25
2621
5a5852a417b1 clone: disable stream support on server side by default.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2613
diff changeset
    26
echo % try to clone via stream, should use pull instead
10154
d4a62b6d4a58 run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 9506
diff changeset
    27
hg clone --uncompressed http://localhost:$HGPORT1/ copy2
2612
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    28
ffb895f16925 add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    29
echo % clone via pull
10154
d4a62b6d4a58 run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 9506
diff changeset
    30
hg clone http://localhost:$HGPORT1/ copy-pull
2676
7c81e337fed2 Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2673
diff changeset
    31
hg verify -R copy-pull
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    32
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    33
cd test
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    34
echo bar > bar
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    35
hg commit -A -d '1 0' -m 2
2676
7c81e337fed2 Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2673
diff changeset
    36
cd ..
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    37
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    38
echo % pull
2676
7c81e337fed2 Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2673
diff changeset
    39
cd copy-pull
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2622
diff changeset
    40
echo '[hooks]' >> .hg/hgrc
4289
e17598881509 test-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4130
diff changeset
    41
echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
10398
ace3cf2bc991 tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents: 10154
diff changeset
    42
hg pull | sed -e "s,:$HGPORT1/,:\$HGPORT1/,"
2676
7c81e337fed2 Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2673
diff changeset
    43
cd ..