tests/test-fetch
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 29 Mar 2008 21:15:34 +0100
changeset 6403 f615ece5fec3
parent 6246 35bf9c23e17a
child 7007 a6b74fbb5ce0
permissions -rwxr-xr-x
hgweb: remove dead code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2822
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
6246
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
     3
# adjust to non-default HGPORT, e.g. with run-tests.py -j
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
     4
hideport() { sed "s/localhost:$HGPORT/localhost:20059/"; }
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
     5
hidehash() { sed "s/changeset 3:............ merges/changeset 3:... merges/"; }
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
     6
2990
61fcd9fac434 Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2823
diff changeset
     7
echo "[extensions]" >> $HGRCPATH
61fcd9fac434 Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2823
diff changeset
     8
echo "fetch=" >> $HGRCPATH
2822
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     9
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    10
hg init a
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    11
echo a > a/a
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    12
hg --cwd a commit -d '1 0' -Ama
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    14
hg clone a b
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    15
hg clone a c
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    16
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    17
echo b > a/b
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    18
hg --cwd a commit -d '2 0' -Amb
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    19
hg --cwd a parents -q
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    21
echo % should pull one change
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    22
hg --cwd b fetch ../a
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    23
hg --cwd b parents -q
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    24
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    25
echo c > c/c
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    26
hg --cwd c commit -d '3 0' -Amc
5798
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    27
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    28
hg clone c d
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    29
hg clone c e
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    30
6207
03b13d853dc6 fetch: make test reproducible, tiny code cleanup
Bryan O'Sullivan <bos@serpentine.com>
parents: 6206
diff changeset
    31
# We cannot use the default commit message if fetching from a local
03b13d853dc6 fetch: make test reproducible, tiny code cleanup
Bryan O'Sullivan <bos@serpentine.com>
parents: 6206
diff changeset
    32
# repo, because the path of the repo will be included in the commit
03b13d853dc6 fetch: make test reproducible, tiny code cleanup
Bryan O'Sullivan <bos@serpentine.com>
parents: 6206
diff changeset
    33
# message, making every commit appear different.
03b13d853dc6 fetch: make test reproducible, tiny code cleanup
Bryan O'Sullivan <bos@serpentine.com>
parents: 6206
diff changeset
    34
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    35
echo % should merge c into a
2823
e0caea53c997 test-fetch: make output stable
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2822
diff changeset
    36
hg --cwd c fetch -d '4 0' -m 'automated merge' ../a
2822
4f7abf341cd4 fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    37
ls c
5798
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    38
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    39
hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    40
cat a/hg.pid >> "$DAEMON_PIDS"
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    41
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    42
echo '% fetch over http, no auth'
6246
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
    43
hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/ | hideport | hidehash
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
    44
hg --cwd d tip --template '{desc}\n' | hideport
5798
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    45
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 2990
diff changeset
    46
echo '% fetch over http with auth (should be hidden in desc)'
6246
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
    47
hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/ | hideport | hidehash
35bf9c23e17a adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6235
diff changeset
    48
hg --cwd e tip --template '{desc}\n' | hideport
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    49
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    50
hg clone a f
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    51
hg clone a g
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    52
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    53
echo f > f/f
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    54
hg --cwd f ci -d '6 0' -Amf
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    55
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    56
echo g > g/g
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    57
hg --cwd g ci -d '6 0' -Amg
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    58
6226
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    59
hg clone -q f h
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    60
hg clone -q g i
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    61
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 5798
diff changeset
    62
echo % should merge f into g
6207
03b13d853dc6 fetch: make test reproducible, tiny code cleanup
Bryan O'Sullivan <bos@serpentine.com>
parents: 6206
diff changeset
    63
hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f
6226
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    64
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    65
rm i/g
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    66
echo % should abort, because i is modified
bd61e44eb2cc fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents: 6207
diff changeset
    67
hg --cwd i fetch ../h
6235
d16798000be0 test-fetch failed due to non-zero exit code
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6226
diff changeset
    68
d16798000be0 test-fetch failed due to non-zero exit code
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6226
diff changeset
    69
true