tests/test-clone
author Patrick Mezard <pmezard@gmail.com>
Wed, 10 Dec 2008 17:47:56 +0100
changeset 7503 09508f8e2fa4
parent 6947 a7fcb43af82e
child 7927 a218ba5f60df
permissions -rwxr-xr-x
test-convert-cvs-builtincvsps: test debugcvsps command
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
749
7e4843b7efd2 Update tests to use commit -m and default -u
mpm@selenic.com
parents: 550
diff changeset
    10
hg commit -m test -d '0 0'
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
a7fcb43af82e increase code coverage of test-clone
Adrian Buehlmann <adrian@cadifra.com>
parents: 6088
diff changeset
    17
    hg commit -m test -d '0 0'
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
5225
76c4cadb49fc clone: remove "file://" before making the path absolute
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1926
diff changeset
    63
exit 0