tests/test-clone
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Wed, 02 Sep 2009 21:05:01 +0200
changeset 9414 65dc516363ee
parent 8167 6c82beaaa11a
child 9714 2f1ab7f77ddc
permissions -rwxr-xr-x
manifest: simplify cache handling, use a unique cache
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
834
78a9f95766dc Use sh instead of bash in tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 814
diff changeset
     1
#!/bin/sh
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     2
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
     3
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
     4
echo % prepare repo a
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     5
mkdir a
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     6
cd a
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     7
hg init
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     8
echo a > a
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     9
hg add a
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7927
diff changeset
    10
hg commit -m test
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    11
echo first line > b
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    12
hg add b
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    13
# create a non-inlined filelog
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    14
python -c 'for x in range(10000): print x' >> data1
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    15
for j in 0 1 2 3 4 5 6 7 8 9; do
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    16
    cat data1 >> b
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7927
diff changeset
    17
    hg commit -m test
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    18
done
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    19
echo % "list files in store/data (should show a 'b.d')"
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    20
for i in .hg/store/data/*; do
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    21
    echo $i
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    22
done
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    23
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    24
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    25
echo % default operation
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    26
hg clone . ../b
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    27
cd ../b
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    28
cat a
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    29
hg verify
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    30
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    31
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    32
echo % no update
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    33
hg clone -U . ../c
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    34
cd ../c
1926
ba198d17eea9 changes by John Levon to standardize some erroroutput
Peter van Dijk <peter@dataloss.nl>
parents: 839
diff changeset
    35
cat a 2>/dev/null || echo "a not present"
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    36
hg verify
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    37
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    38
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    39
echo % default destination
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    40
mkdir ../d
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    41
cd ../d
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    42
hg clone ../a
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    43
cd a
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    44
hg cat a
5225
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    45
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    46
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    47
echo % "check that we drop the file:// from the path before"
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    48
echo % "writing the .hgrc"
5225
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    49
cd ../..
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    50
hg clone file://a e
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    51
grep 'file:' e/.hg/hgrc
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    52
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    53
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    54
echo % check that path aliases are expanded
6088
3b96cefc1b2b clone: expand the path before saving it in .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5225
diff changeset
    55
hg clone -q -U --config 'paths.foobar=a#0' foobar f
3b96cefc1b2b clone: expand the path before saving it in .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5225
diff changeset
    56
hg -R f showconfig paths.default | sed -e 's,.*/,,'
3b96cefc1b2b clone: expand the path before saving it in .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5225
diff changeset
    57
6947
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    58
echo
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    59
echo % use --pull
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    60
hg clone --pull a g
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    61
hg -R g verify
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    62
7927
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    63
echo
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    64
echo % clone to '.'
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    65
mkdir h
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    66
cd h
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    67
hg clone ../a .
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    68
cd ..
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 6947
diff changeset
    69
5225
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    70
exit 0