Debian Codegraph @

tests/test-convert-splicemap.t

raw
1
2 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "convert=" >> $HGRCPATH
4 $ glog()
5 > {
6 > hg log -G --template '{rev}:{node|short} "{desc|firstline}"\
7 > files: {files}\n' "$@"
8 > }
9 $ hg init repo1
10 $ cd repo1
11 $ echo a > a
12 $ hg ci -Am adda
13 adding a
14 $ echo b > b
15 $ echo a >> a
16 $ hg ci -Am addb
17 adding b
18 $ PARENTID1=`hg id -r . -T "{node}"`
19 $ echo c > c
20 $ hg ci -Am addc
21 adding c
22 $ PARENTID2=`hg id -r . -T "{node}"`
23 $ cd ..
24 $ glog -R repo1
25 @ 2:e55c719b85b6 "addc" files: c
26 |
27 o 1:6d4c2037ddc2 "addb" files: a b
28 |
29 o 0:07f494440405 "adda" files: a
30
31
32 $ hg init repo2
33 $ cd repo2
34 $ echo b > a
35 $ echo d > d
36 $ hg ci -Am addaandd
37 adding a
38 adding d
39 $ INVALIDID1=afd12345af
40 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
41 $ CHILDID1=`hg id -r . -T "{node}"`
42 $ echo d >> d
43 $ hg ci -Am changed
44 $ CHILDID2=`hg id -r . -T "{node}"`
45 $ echo e > e
46 $ hg ci -Am adde
47 adding e
48 $ cd ..
49 $ glog -R repo2
50 @ 2:a39b65753b0a "adde" files: e
51 |
52 o 1:e4ea00df9189 "changed" files: d
53 |
54 o 0:527cdedf31fb "addaandd" files: a d
55
56
57 test invalid splicemap1
58
59 $ cat > splicemap <<EOF
60 > $CHILDID2
61 > EOF
62 $ hg convert --splicemap splicemap repo2 repo1
63 abort: syntax error in splicemap(1): child parent1[,parent2] expected
64 [255]
65
66 test invalid splicemap2
67
68 $ cat > splicemap <<EOF
69 > $CHILDID2 $PARENTID1, $PARENTID2, $PARENTID2
70 > EOF
71 $ hg convert --splicemap splicemap repo2 repo1
72 abort: syntax error in splicemap(1): child parent1[,parent2] expected
73 [255]
74
75 test invalid splicemap3
76
77 $ cat > splicemap <<EOF
78 > $INVALIDID1 $INVALIDID2
79 > EOF
80 $ hg convert --splicemap splicemap repo2 repo1
81 abort: splicemap entry afd12345af is not a valid revision identifier
82 [255]
83
84 splice repo2 on repo1
85
86 $ cat > splicemap <<EOF
87 > $CHILDID1 $PARENTID1
88 > $CHILDID2 $PARENTID2,$CHILDID1
89 >
90 > EOF
91 $ cat splicemap
92 527cdedf31fbd5ea708aa14eeecf53d4676f38db 6d4c2037ddc2cb2627ac3a244ecce35283268f8e
93 e4ea00df91897da3079a10fab658c1eddba6617b e55c719b85b60e5102fac26110ba626e7cb6b7dc,527cdedf31fbd5ea708aa14eeecf53d4676f38db
94
95 $ hg clone repo1 target1
96 updating to branch default
97 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 $ hg convert --splicemap splicemap repo2 target1
99 scanning source...
100 sorting...
101 converting...
102 2 addaandd
103 spliced in 6d4c2037ddc2cb2627ac3a244ecce35283268f8e as parents of 527cdedf31fbd5ea708aa14eeecf53d4676f38db
104 1 changed
105 spliced in e55c719b85b60e5102fac26110ba626e7cb6b7dc and 527cdedf31fbd5ea708aa14eeecf53d4676f38db as parents of e4ea00df91897da3079a10fab658c1eddba6617b
106 0 adde
107 $ glog -R target1
108 o 5:16bc847b02aa "adde" files: e
109 |
110 o 4:e30e4fee3418 "changed" files: d
111 |\
112 | o 3:e673348c3a3c "addaandd" files: a d
113 | |
114 @ | 2:e55c719b85b6 "addc" files: c
115 |/
116 o 1:6d4c2037ddc2 "addb" files: a b
117 |
118 o 0:07f494440405 "adda" files: a
119
120
121
122
123 Test splicemap and conversion order
124
125 $ hg init ordered
126 $ cd ordered
127 $ echo a > a
128 $ hg ci -Am adda
129 adding a
130 $ hg branch branch
131 marked working directory as branch branch
132 (branches are permanent and global, did you want a bookmark?)
133 $ echo a >> a
134 $ hg ci -Am changea
135 $ echo a >> a
136 $ hg ci -Am changeaagain
137 $ hg up 0
138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 $ echo b > b
140 $ hg ci -Am addb
141 adding b
142
143 We want 2 to depend on 1 and 3. Since 3 is always converted after 2,
144 the bug should be exhibited with all conversion orders.
145
146 $ cat > ../splicemap <<EOF
147 > `(hg id -r 2 -i --debug)` `(hg id -r 1 -i --debug)`, `(hg id -r 3 -i --debug)`
148 > EOF
149 $ cd ..
150 $ cat splicemap
151 7c364e7fa7d70ae525610c016317ed717b519d97 717d54d67e6c31fd75ffef2ff3042bdd98418437, 102a90ea7b4a3361e4082ed620918c261189a36a
152
153 Test regular conversion
154
155 $ hg convert --splicemap splicemap ordered ordered-hg1
156 initializing destination ordered-hg1 repository
157 scanning source...
158 sorting...
159 converting...
160 3 adda
161 2 changea
162 1 addb
163 0 changeaagain
164 spliced in 717d54d67e6c31fd75ffef2ff3042bdd98418437 and 102a90ea7b4a3361e4082ed620918c261189a36a as parents of 7c364e7fa7d70ae525610c016317ed717b519d97
165 $ glog -R ordered-hg1
166 o 3:4cb04b9afbf2 "changeaagain" files: a
167 |\
168 | o 2:102a90ea7b4a "addb" files: b
169 | |
170 o | 1:717d54d67e6c "changea" files: a
171 |/
172 o 0:07f494440405 "adda" files: a
173
174
175 Test conversion with parent revisions already in dest, using source
176 and destination identifiers. Test unknown splicemap target.
177
178 $ hg convert -r1 ordered ordered-hg2
179 initializing destination ordered-hg2 repository
180 scanning source...
181 sorting...
182 converting...
183 1 adda
184 0 changea
185 $ hg convert -r3 ordered ordered-hg2
186 scanning source...
187 sorting...
188 converting...
189 0 addb
190 $ cat > splicemap <<EOF
191 > `(hg -R ordered id -r 2 -i --debug)` \
192 > `(hg -R ordered-hg2 id -r 1 -i --debug)`,\
193 > `(hg -R ordered-hg2 id -r 2 -i --debug)`
194 > deadbeef102a90ea7b4a3361e4082ed620918c26 deadbeef102a90ea7b4a3361e4082ed620918c27
195 > EOF
196 $ hg convert --splicemap splicemap ordered ordered-hg2
197 scanning source...
198 splice map revision deadbeef102a90ea7b4a3361e4082ed620918c26 is not being converted, ignoring
199 sorting...
200 converting...
201 0 changeaagain
202 spliced in 717d54d67e6c31fd75ffef2ff3042bdd98418437 and 102a90ea7b4a3361e4082ed620918c261189a36a as parents of 7c364e7fa7d70ae525610c016317ed717b519d97
203 $ glog -R ordered-hg2
204 o 3:4cb04b9afbf2 "changeaagain" files: a
205 |\
206 | o 2:102a90ea7b4a "addb" files: b
207 | |
208 o | 1:717d54d67e6c "changea" files: a
209 |/
210 o 0:07f494440405 "adda" files: a
211
212
213 Test empty conversion
214
215 $ hg convert --splicemap splicemap ordered ordered-hg2
216 scanning source...
217 splice map revision deadbeef102a90ea7b4a3361e4082ed620918c26 is not being converted, ignoring
218 sorting...
219 converting...
220
221 Test clonebranches
222
223 $ hg --config convert.hg.clonebranches=true convert \
224 > --splicemap splicemap ordered ordered-hg3
225 initializing destination ordered-hg3 repository
226 scanning source...
227 abort: revision 717d54d67e6c31fd75ffef2ff3042bdd98418437 not found in destination repository (lookups with clonebranches=true are not implemented)
228 [255]
229
230 Test invalid dependency
231
232 $ cat > splicemap <<EOF
233 > `(hg -R ordered id -r 2 -i --debug)` \
234 > deadbeef102a90ea7b4a3361e4082ed620918c26,\
235 > `(hg -R ordered-hg2 id -r 2 -i --debug)`
236 > EOF
237 $ hg convert --splicemap splicemap ordered ordered-hg4
238 initializing destination ordered-hg4 repository
239 scanning source...
240 abort: unknown splice map parent: deadbeef102a90ea7b4a3361e4082ed620918c26
241 [255]