Mercurial > hg
annotate tests/test-transplant @ 9680:8cea86d73887
lock: use '==' instead of 'is' for integer equality ('is' may not work)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 31 Oct 2009 17:07:12 +0100 |
parents | 8b35b08724eb |
children | eba6c8687fd2 |
rev | line source |
---|---|
3714 | 1 #!/bin/sh |
2 | |
3 cat <<EOF >> $HGRCPATH | |
4 [extensions] | |
5 transplant= | |
6 EOF | |
7 | |
8 hg init t | |
9 cd t | |
10 echo r1 > r1 | |
11 hg ci -Amr1 -d'0 0' | |
12 echo r2 > r2 | |
13 hg ci -Amr2 -d'1 0' | |
14 hg up 0 | |
15 | |
16 echo b1 > b1 | |
17 hg ci -Amb1 -d '0 0' | |
18 echo b2 > b2 | |
19 hg ci -Amb2 -d '1 0' | |
20 echo b3 > b3 | |
21 hg ci -Amb3 -d '2 0' | |
22 | |
23 hg log --template '{rev} {parents} {desc}\n' | |
24 | |
4034
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
25 hg clone . ../rebase |
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
26 cd ../rebase |
3714 | 27 |
28 hg up -C 1 | |
29 echo '% rebase b onto r1' | |
30 hg transplant -a -b tip | |
31 hg log --template '{rev} {parents} {desc}\n' | |
32 | |
4034
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
33 hg clone ../t ../prune |
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
34 cd ../prune |
3714 | 35 |
36 hg up -C 1 | |
37 echo '% rebase b onto r1, skipping b2' | |
38 hg transplant -a -b tip -p 3 | |
39 hg log --template '{rev} {parents} {desc}\n' | |
40 | |
41 echo '% remote transplant' | |
4034
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
42 hg clone -r 1 ../t ../remote |
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
43 cd ../remote |
3714 | 44 hg transplant --log -s ../t 2 4 |
45 hg log --template '{rev} {parents} {desc}\n' | |
46 | |
47 echo '% skip previous transplants' | |
48 hg transplant -s ../t -a -b 4 | |
49 hg log --template '{rev} {parents} {desc}\n' | |
50 | |
51 echo '% skip local changes transplanted to the source' | |
52 echo b4 > b4 | |
53 hg ci -Amb4 -d '3 0' | |
4034
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
54 hg clone ../t ../pullback |
9bd078ce8de9
Minor test-transplant cleanup
Brendan Cully <brendan@kublai.com>
parents:
3758
diff
changeset
|
55 cd ../pullback |
3714 | 56 hg transplant -s ../remote -a -b tip |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
57 |
4036
ebf1a05f6479
Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents:
4034
diff
changeset
|
58 echo '% remote transplant with pull' |
5384
e3a0c092b4e2
Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4050
diff
changeset
|
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid |
4050
75313c36aa04
transplant: test non-local source
Brendan Cully <brendan@kublai.com>
parents:
4036
diff
changeset
|
60 cat ../t.pid >> $DAEMON_PIDS |
75313c36aa04
transplant: test non-local source
Brendan Cully <brendan@kublai.com>
parents:
4036
diff
changeset
|
61 |
4036
ebf1a05f6479
Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents:
4034
diff
changeset
|
62 hg clone -r 0 ../t ../rp |
ebf1a05f6479
Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents:
4034
diff
changeset
|
63 cd ../rp |
5384
e3a0c092b4e2
Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4050
diff
changeset
|
64 hg transplant -s http://localhost:$HGPORT/ 2 4 |
4036
ebf1a05f6479
Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents:
4034
diff
changeset
|
65 hg log --template '{rev} {parents} {desc}\n' |
ebf1a05f6479
Make test-transplant test pull case
Brendan Cully <brendan@kublai.com>
parents:
4034
diff
changeset
|
66 |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
67 echo '% transplant --continue' |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
68 hg init ../tc |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
69 cd ../tc |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
70 cat <<EOF > foo |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
71 foo |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
72 bar |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
73 baz |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
74 EOF |
3726
752884db5037
transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents:
3724
diff
changeset
|
75 echo toremove > toremove |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6639
diff
changeset
|
76 hg ci -Amfoo |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
77 cat <<EOF > foo |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
78 foo2 |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
79 bar2 |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
80 baz2 |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
81 EOF |
3726
752884db5037
transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents:
3724
diff
changeset
|
82 rm toremove |
752884db5037
transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents:
3724
diff
changeset
|
83 echo added > added |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6639
diff
changeset
|
84 hg ci -Amfoo2 |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
85 echo bar > bar |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6639
diff
changeset
|
86 hg ci -Ambar |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
87 echo bar2 >> bar |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6639
diff
changeset
|
88 hg ci -mbar2 |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
89 hg up 0 |
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
90 echo foobar > foo |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6639
diff
changeset
|
91 hg ci -mfoobar |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
92 hg transplant 1:3 |
3758
889f7e74a0d9
transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents:
3726
diff
changeset
|
93 # transplant -c shouldn't use an old changeset |
889f7e74a0d9
transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents:
3726
diff
changeset
|
94 hg up -C |
8518
3f4f14eab085
update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8173
diff
changeset
|
95 rm added |
3758
889f7e74a0d9
transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents:
3726
diff
changeset
|
96 hg transplant 1 |
3724
ea523d6f5f1a
transplant: fix --continue; add --continue test
Brendan Cully <brendan@kublai.com>
parents:
3714
diff
changeset
|
97 hg transplant --continue |
3758
889f7e74a0d9
transplant: log source node when recovering too.
Brendan Cully <brendan@kublai.com>
parents:
3726
diff
changeset
|
98 hg transplant 1:3 |
3726
752884db5037
transplant: recover added/removed files after failed application
Brendan Cully <brendan@kublai.com>
parents:
3724
diff
changeset
|
99 hg locate |
6639
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
100 cd .. |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
101 |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
102 # Test transplant --merge (issue 1111) |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
103 echo % test transplant merge |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
104 hg init t1111 |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
105 cd t1111 |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
106 echo a > a |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
107 hg ci -Am adda |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
108 echo b >> a |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
109 hg ci -m appendb |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
110 echo c >> a |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
111 hg ci -m appendc |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
112 hg up -C 0 |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
113 echo d >> a |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
114 hg ci -m appendd |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
115 echo % tranplant |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
116 hg transplant -m 1 |
6334569c8caa
localrepo: fix partial merge test (issue 1111)
Patrick Mezard <pmezard@gmail.com>
parents:
5384
diff
changeset
|
117 cd .. |
8173
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
118 |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
119 echo '% test transplant into empty repository' |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
120 hg init empty |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
121 cd empty |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
122 hg transplant -s ../t -b tip -a |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
123 cd .. |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
124 |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
125 echo '% test filter' |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
126 hg init filter |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
127 cd filter |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
128 cat <<'EOF' >test-filter |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
129 #!/bin/sh |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
130 sed 's/r1/r2/' $1 > $1.new |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
131 mv $1.new $1 |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
132 EOF |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
133 chmod +x test-filter |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
134 hg transplant -s ../t -b tip -a --filter ./test-filter |\ |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
135 sed 's/filtering.*/filtering/g' |
d3fb413667e5
transplant: remove the restriction that the destination be nonempty.
Jacob Lee <artdent@gmail.com>
parents:
8167
diff
changeset
|
136 hg log --template '{rev} {parents} {desc}\n' |
8811
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
137 cd .. |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
138 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
139 echo '% test with a win32ext like setup (differing EOLs)' |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
140 hg init twin1 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
141 cd twin1 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
142 echo a > a |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
143 echo b > b |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
144 echo b >> b |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
145 hg ci -Am t |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
146 echo a > b |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
147 echo b >> b |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
148 hg ci -m changeb |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
149 cd .. |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
150 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
151 hg init twin2 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
152 cd twin2 |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
153 echo '[patch]' >> .hg/hgrc |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
154 echo 'eol = crlf' >> .hg/hgrc |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
155 python -c "file('b', 'wb').write('b\r\nb\r\n')" |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
156 hg ci -m addb |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
157 hg transplant -s ../twin1 tip |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
158 python -c "print repr(file('b', 'rb').read())" |
8b35b08724eb
Make mq, record and transplant honor patch.eol
Patrick Mezard <pmezard@gmail.com>
parents:
8518
diff
changeset
|
159 cd .. |