Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-ssh-clone-r @ 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 | 6b1e1b9da853 |
children |
rev | line source |
---|---|
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
1 #!/bin/sh |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
2 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
3 # This test tries to exercise the ssh functionality with a dummy script |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
4 |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
5 cat <<EOF > dummyssh |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
6 import sys |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
7 import os |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
8 |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
9 os.chdir(os.path.dirname(sys.argv[0])) |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
10 if sys.argv[1] != "user@dummy": |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
11 sys.exit(-1) |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
12 |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
13 if not os.path.exists("dummyssh"): |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
14 sys.exit(-1) |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
15 |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
16 os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
17 |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
18 log = open("dummylog", "ab") |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
19 log.write("Got arguments") |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
20 for i, arg in enumerate(sys.argv[1:]): |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
21 log.write(" %d:%s" % (i+1, arg)) |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
22 log.write("\n") |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
23 log.close() |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
24 r = os.system(sys.argv[2]) |
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
25 sys.exit(bool(r)) |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
26 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
27 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
28 hg init remote |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
29 cd remote |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
30 echo "# creating 'remote'" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
31 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
32 0 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
33 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
34 hg add afile |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
35 hg commit -m "0.0" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
36 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
37 1 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
38 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
39 hg commit -m "0.1" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
40 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
41 2 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
42 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
43 hg commit -m "0.2" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
44 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
45 3 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
46 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
47 hg commit -m "0.3" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
48 hg update -C 0 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
49 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
50 1 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
51 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
52 hg commit -m "1.1" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
53 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
54 2 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
55 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
56 hg commit -m "1.2" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
57 cat >fred <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
58 a line |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
59 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
60 cat >>afile <<EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
61 3 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
62 EOF |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
63 hg add fred |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
64 hg commit -m "1.3" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
65 hg mv afile adifferentfile |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
66 hg commit -m "1.3m" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
67 hg update -C 3 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
68 hg mv afile anotherfile |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
69 hg commit -m "0.3m" |
3853
c0b449154a90
switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3449
diff
changeset
|
70 hg debugindex .hg/store/data/afile.i |
c0b449154a90
switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3449
diff
changeset
|
71 hg debugindex .hg/store/data/adifferentfile.i |
c0b449154a90
switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3449
diff
changeset
|
72 hg debugindex .hg/store/data/anotherfile.i |
c0b449154a90
switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3449
diff
changeset
|
73 hg debugindex .hg/store/data/fred.i |
c0b449154a90
switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3449
diff
changeset
|
74 hg debugindex .hg/store/00manifest.i |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
75 hg verify |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
76 cd .. |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
77 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
78 echo "# clone remote via stream" |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
79 for i in 0 1 2 3 4 5 6 7 8; do |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
80 hg clone -e "python ./dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i" 2>&1 |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
81 if cd test-"$i"; then |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
82 hg verify |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
83 cd .. |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
84 fi |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
85 done |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
86 cd test-8 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
87 hg pull ../test-7 |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
88 hg verify |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
89 cd .. |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
90 cd test-1 |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
91 hg pull -e "python ../dummyssh" -r 4 ssh://user@dummy/remote 2>&1 |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
92 hg verify |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
93 hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1 |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
94 cd .. |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
95 cd test-2 |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
96 hg pull -e "python ../dummyssh" -r 5 ssh://user@dummy/remote 2>&1 |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
97 hg verify |
4299
6b1e1b9da853
test-ssh-clone-r: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3853
diff
changeset
|
98 hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1 |
3449
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
99 hg verify |
c8686e3f0291
Testing the new changegroupsubset remote function in the ssh
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
100 cd .. |