annotate tests/test-bundle @ 5192:33015dac5df5

convert: fix mercurial_sink.putcommit Changeset 4ebc8693ce72 added some code to putcommit to avoid creating a revision that touches no files, but this can break regular conversions from some repositories: - conceptually, since we're converting a repo, we should try to make the new hg repo as similar as possible to the original repo - we should create a new changeset, even if the original revision didn't touch any files (maybe the commit message had some important bit); - even if a "regular" revision that doesn't touch any file may seem weird (and maybe even broken), it's completely legitimate for a merge revision to not touch any file, and, if we just skip it, the converted repo will end up with wrong history and possibly an extra head. As an example, say the crew and main hg repos are sync'ed. Somebody sends an important patch to the mailing list. Matt quickly applies and pushes it. But at the same time somebody also applies it to crew and pushes it. Suppose the commit message ended up being a bit different (say, there was a typo and somebody didn't fix it) or that the date ended up being different (because of different patch-applying scripts): the changeset hashes will be different, but the manifests will be the same. Since both changesets were pushed to public repos, it's hard to recall them. If both are merged, the manifest from the resulting merge revision will have the exact same contents as its parents - i.e. the merge revision really doesn't touch any file at all. To keep the file filtering stuff "working", the generic code was changed to skip empty revisions if we're filtering the repo, fixing a bug in the process (we want parents[0] instead of tip).
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 17 Aug 2007 20:18:05 -0300
parents a6b62584d0b2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
5 hg init test
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
6 cd test
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
7 echo 0 > afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
8 hg add afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
9 hg commit -m "0.0" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
10 echo 1 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
11 hg commit -m "0.1" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
12 echo 2 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
13 hg commit -m "0.2" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
14 echo 3 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
15 hg commit -m "0.3" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
16 hg update -C 0
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
17 echo 1 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
18 hg commit -m "1.1" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
19 echo 2 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
20 hg commit -m "1.2" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
21 echo "a line" > fred
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
22 echo 3 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
23 hg add fred
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
24 hg commit -m "1.3" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
25 hg mv afile adifferentfile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
26 hg commit -m "1.3m" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
27 hg update -C 3
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
28 hg mv afile anotherfile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
29 hg commit -m "0.3m" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
30 hg verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
31 cd ..
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
32 hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
33 hg -R test bundle full.hg empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
34 hg -R test unbundle full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
35 hg -R empty heads
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
36 hg -R empty verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
37
2737
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
38 hg --cwd test 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
39 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
40 hg -R empty rollback
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
41 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
42
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: 3419
diff changeset
43 rm -r empty
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
44 hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
45 cd empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
46 hg -R bundle://../full.hg log
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2274
diff changeset
47 echo '[hooks]' >> .hg/hgrc
4287
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
48 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
49 #doesn't work (yet ?)
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
50 #hg -R bundle://../full.hg verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
51 hg pull bundle://../full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
52 cd ..
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
53
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: 3419
diff changeset
54 rm -r empty
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
55 hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
56 hg clone -r 3 test partial
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
57 hg clone partial partial2
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
58 cd partial
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
59 hg -R bundle://../full.hg log
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
60 hg incoming bundle://../full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
61 hg -R bundle://../full.hg outgoing ../partial2
3419
b19360aa21e9 bundlerepo: avoid exception in __del__ when the bundle doesn't exist
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2737
diff changeset
62 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
63 cd ..
4042
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
64
4699
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
65 # test for http://www.selenic.com/mercurial/bts/issue216
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
66 rm -r empty
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
67 hg init empty
a6b62584d0b2 unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 4287
diff changeset
68 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
69 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
70 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
71
4042
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
72 # test for 540d1059c802
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
73 hg init orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
74 cd orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
75 echo foo > foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
76 hg add foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
77 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
78
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
79 hg clone . ../copy
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
80 hg tag -d '0 0' foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
81
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
82 cd ../copy
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
83 echo >> foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
84 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
85 hg bundle ../bundle.hg ../orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
86
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
87 cd ../orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
88 hg incoming ../bundle.hg
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
89 cd ..