tests/test-bundle
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
Sat, 03 Nov 2007 11:11:13 +0100
changeset 5663 99fdef2e6793
parent 4699 a6b62584d0b2
child 5664 da72b4d24797
permissions -rwxr-xr-x
Add output markers to test-bundle so it's easier to spot the source of output diffs.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     1
#!/bin/sh
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
4287
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
     3
cp "$TESTDIR"/printenv.py .
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
     4
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
     5
echo "====== Setting up test"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     6
hg init test
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     7
cd test
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     8
echo 0 > afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     9
hg add afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    10
hg commit -m "0.0" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    11
echo 1 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    12
hg commit -m "0.1" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    13
echo 2 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    14
hg commit -m "0.2" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    15
echo 3 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    16
hg commit -m "0.3" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    17
hg update -C 0
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    18
echo 1 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    19
hg commit -m "1.1" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    20
echo 2 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    21
hg commit -m "1.2" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    22
echo "a line" > fred
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    23
echo 3 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    24
hg add fred
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    25
hg commit -m "1.3" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    26
hg mv afile adifferentfile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    27
hg commit -m "1.3m" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    28
hg update -C 3
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    29
hg mv afile anotherfile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    30
hg commit -m "0.3m" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
hg verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    32
cd ..
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    33
hg init empty
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    34
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    35
echo "====== Bundle test to full.hg"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    36
hg -R test bundle full.hg empty
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    37
echo "====== Unbundle full.hg in test"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    38
hg -R test unbundle full.hg
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    39
echo "====== Verify empty"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    40
hg -R empty heads
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    41
hg -R empty verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    42
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    43
echo "====== Pull full.hg into test (using --cwd)"
2738
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    44
hg --cwd test pull ../full.hg
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    45
echo "====== Pull full.hg into empty (using --cwd)"
2738
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    46
hg --cwd empty pull ../full.hg
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    47
echo "====== Rollback empty"
2738
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    48
hg -R empty rollback
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    49
echo "====== Pull full.hg into empty again (using --cwd)"
2738
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    50
hg --cwd empty pull ../full.hg
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    51
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    52
echo "====== Log -R full.hg in fresh empty"
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3429
diff changeset
    53
rm -r empty
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    54
hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    55
cd empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    56
hg -R bundle://../full.hg log
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    57
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    58
echo "====== Pull ../full.hg into empty (with hook)"
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2274
diff changeset
    59
echo '[hooks]' >> .hg/hgrc
4287
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
    60
echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    61
#doesn't work (yet ?)
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    62
#hg -R bundle://../full.hg verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    63
hg pull bundle://../full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    64
cd ..
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    65
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    66
echo "====== Create partial clones"
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3429
diff changeset
    67
rm -r empty
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    68
hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    69
hg clone -r 3 test partial
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    70
hg clone partial partial2
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    71
cd partial
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    72
echo "====== Log -R full.hg in partial"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    73
hg -R bundle://../full.hg log
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    74
echo "====== Incoming full.hg in partial"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    75
hg incoming bundle://../full.hg
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    76
echo "====== Outgoing -R full.hg vs partial2 in partial"
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    77
hg -R bundle://../full.hg outgoing ../partial2
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    78
echo "====== Outgoing -R does-not-exist.hg vs partial2 in partial"
3429
b19360aa21e9 bundlerepo: avoid exception in __del__ when the bundle doesn't exist
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2738
diff changeset
    79
hg -R bundle://../does-not-exist.hg outgoing ../partial2
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    80
cd ..
4042
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    81
4699
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    82
# test for http://www.selenic.com/mercurial/bts/issue216
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    83
echo "====== Unbundle incremental bundles into fresh empty in one go"
4699
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    84
rm -r empty
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    85
hg init empty
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    86
hg -R test bundle --base null -r 0 ../0.hg
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    87
hg -R test bundle --base 0    -r 1 ../1.hg
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    88
hg -R empty unbundle -u ../0.hg ../1.hg
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
    89
4042
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    90
# test for 540d1059c802
5663
99fdef2e6793 Add output markers to test-bundle so it's easier to spot the source of
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 4699
diff changeset
    91
echo "====== test for 540d1059c802"
4042
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    92
hg init orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    93
cd orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    94
echo foo > foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    95
hg add foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    96
hg ci -m 'add foo' -d '0 0'
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    97
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    98
hg clone . ../copy
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    99
hg tag -d '0 0' foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   100
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   101
cd ../copy
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   102
echo >> foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   103
hg ci -m 'change foo' -d '0 0'
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   104
hg bundle ../bundle.hg ../orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   105
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   106
cd ../orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   107
hg incoming ../bundle.hg
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   108
cd ..