##// END OF EJS Templates
tests: unify test-mq-strip
Nicolas Dumazet -
r11906:1219d019 default
parent child Browse files
Show More
@@ -1,94 +1,382 b''
1 #!/bin/sh
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "graphlog=" >> $HGRCPATH
4
5 $ restore() {
6 > hg unbundle -q .hg/strip-backup/*
7 > rm .hg/strip-backup/*
8 > }
9 $ teststrip() {
10 > hg up -C $1
11 > echo % before update $1, strip $2
12 > hg parents
13 > hg --traceback strip $2
14 > echo % after update $1, strip $2
15 > hg parents
16 > restore
17 > }
2
18
3 . $TESTDIR/helpers.sh
19 $ hg init test
20 $ cd test
21
22 $ echo foo > bar
23 $ hg ci -Ama
24 adding bar
25
26 $ echo more >> bar
27 $ hg ci -Amb
28
29 $ echo blah >> bar
30 $ hg ci -Amc
31
32 $ hg up 1
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ echo blah >> bar
35 $ hg ci -Amd
36 created new head
37
38 $ echo final >> bar
39 $ hg ci -Ame
4
40
5 echo "[extensions]" >> $HGRCPATH
41 $ hg log
6 echo "mq=" >> $HGRCPATH
42 changeset: 4:443431ffac4f
7 echo "graphlog=" >> $HGRCPATH
43 tag: tip
44 user: test
45 date: Thu Jan 01 00:00:00 1970 +0000
46 summary: e
47
48 changeset: 3:65bd5f99a4a3
49 parent: 1:ef3a871183d7
50 user: test
51 date: Thu Jan 01 00:00:00 1970 +0000
52 summary: d
53
54 changeset: 2:264128213d29
55 user: test
56 date: Thu Jan 01 00:00:00 1970 +0000
57 summary: c
58
59 changeset: 1:ef3a871183d7
60 user: test
61 date: Thu Jan 01 00:00:00 1970 +0000
62 summary: b
63
64 changeset: 0:9ab35a2d17cb
65 user: test
66 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: a
68
69
70 $ teststrip 4 4
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 % before update 4, strip 4
73 changeset: 4:443431ffac4f
74 tag: tip
75 user: test
76 date: Thu Jan 01 00:00:00 1970 +0000
77 summary: e
78
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 saved backup bundle to .*
81 % after update 4, strip 4
82 changeset: 3:65bd5f99a4a3
83 tag: tip
84 parent: 1:ef3a871183d7
85 user: test
86 date: Thu Jan 01 00:00:00 1970 +0000
87 summary: d
8
88
9 restore() {
89 $ teststrip 4 3
10 hg unbundle -q .hg/strip-backup/*
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 rm .hg/strip-backup/*
91 % before update 4, strip 3
12 }
92 changeset: 4:443431ffac4f
13 teststrip() {
93 tag: tip
14 hg up -C $1
94 user: test
15 echo % before update $1, strip $2
95 date: Thu Jan 01 00:00:00 1970 +0000
16 hg parents
96 summary: e
17 hg --traceback strip $2 | hidebackup
97
18 echo % after update $1, strip $2
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 hg parents
99 saved backup bundle to .*
20 restore
100 % after update 4, strip 3
21 }
101 changeset: 1:ef3a871183d7
102 user: test
103 date: Thu Jan 01 00:00:00 1970 +0000
104 summary: b
22
105
23 hg init test
106 $ teststrip 1 4
24 cd test
107 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 % before update 1, strip 4
109 changeset: 1:ef3a871183d7
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: b
113
114 saved backup bundle to .*
115 % after update 1, strip 4
116 changeset: 1:ef3a871183d7
117 user: test
118 date: Thu Jan 01 00:00:00 1970 +0000
119 summary: b
120
121 $ teststrip 4 2
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 % before update 4, strip 2
124 changeset: 4:443431ffac4f
125 tag: tip
126 user: test
127 date: Thu Jan 01 00:00:00 1970 +0000
128 summary: e
129
130 saved backup bundle to .*
131 % after update 4, strip 2
132 changeset: 3:443431ffac4f
133 tag: tip
134 user: test
135 date: Thu Jan 01 00:00:00 1970 +0000
136 summary: e
25
137
26 echo foo > bar
138 $ teststrip 4 1
27 hg ci -Ama
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 % before update 4, strip 1
141 changeset: 4:264128213d29
142 tag: tip
143 parent: 1:ef3a871183d7
144 user: test
145 date: Thu Jan 01 00:00:00 1970 +0000
146 summary: c
28
147
29 echo more >> bar
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 hg ci -Amb
149 saved backup bundle to .*
150 % after update 4, strip 1
151 changeset: 0:9ab35a2d17cb
152 tag: tip
153 user: test
154 date: Thu Jan 01 00:00:00 1970 +0000
155 summary: a
31
156
32 echo blah >> bar
157 $ teststrip null 4
33 hg ci -Amc
158 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 % before update null, strip 4
160 saved backup bundle to .*
161 % after update null, strip 4
34
162
35 hg up 1
163 $ hg log
36 echo blah >> bar
164 changeset: 4:264128213d29
37 hg ci -Amd
165 tag: tip
166 parent: 1:ef3a871183d7
167 user: test
168 date: Thu Jan 01 00:00:00 1970 +0000
169 summary: c
170
171 changeset: 3:443431ffac4f
172 user: test
173 date: Thu Jan 01 00:00:00 1970 +0000
174 summary: e
38
175
39 echo final >> bar
176 changeset: 2:65bd5f99a4a3
40 hg ci -Ame
177 user: test
178 date: Thu Jan 01 00:00:00 1970 +0000
179 summary: d
41
180
42 hg log
181 changeset: 1:ef3a871183d7
182 user: test
183 date: Thu Jan 01 00:00:00 1970 +0000
184 summary: b
185
186 changeset: 0:9ab35a2d17cb
187 user: test
188 date: Thu Jan 01 00:00:00 1970 +0000
189 summary: a
190
43
191
44 teststrip 4 4
192 $ hg up -C 2
45 teststrip 4 3
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 teststrip 1 4
194 $ hg merge 4
47 teststrip 4 2
195 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 teststrip 4 1
196 (branch merge, don't forget to commit)
49 teststrip null 4
197
198 before strip of merge parent
199
200 $ hg parents
201 changeset: 2:65bd5f99a4a3
202 user: test
203 date: Thu Jan 01 00:00:00 1970 +0000
204 summary: d
50
205
51 hg log
206 changeset: 4:264128213d29
207 tag: tip
208 parent: 1:ef3a871183d7
209 user: test
210 date: Thu Jan 01 00:00:00 1970 +0000
211 summary: c
212
213 $ hg strip 4
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 saved backup bundle to .*
216
217 after strip of merge parent
218
219 $ hg parents
220 changeset: 1:ef3a871183d7
221 user: test
222 date: Thu Jan 01 00:00:00 1970 +0000
223 summary: b
224
225 $ restore
52
226
53 hg up -C 2
227 $ hg up
54 hg merge 4
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 echo % before strip of merge parent
229 $ hg glog
56 hg parents
230 @ changeset: 4:264128213d29
57 hg strip 4 2>&1 | hidebackup
231 | tag: tip
58 echo % after strip of merge parent
232 | parent: 1:ef3a871183d7
59 hg parents
233 | user: test
60 restore
234 | date: Thu Jan 01 00:00:00 1970 +0000
235 | summary: c
236 |
237 | o changeset: 3:443431ffac4f
238 | | user: test
239 | | date: Thu Jan 01 00:00:00 1970 +0000
240 | | summary: e
241 | |
242 | o changeset: 2:65bd5f99a4a3
243 |/ user: test
244 | date: Thu Jan 01 00:00:00 1970 +0000
245 | summary: d
246 |
247 o changeset: 1:ef3a871183d7
248 | user: test
249 | date: Thu Jan 01 00:00:00 1970 +0000
250 | summary: b
251 |
252 o changeset: 0:9ab35a2d17cb
253 user: test
254 date: Thu Jan 01 00:00:00 1970 +0000
255 summary: a
256
257
258 2 is parent of 3, only one strip should happen
259
260 $ hg strip 2 3
261 saved backup bundle to .*
262 $ hg glog
263 @ changeset: 2:264128213d29
264 | tag: tip
265 | user: test
266 | date: Thu Jan 01 00:00:00 1970 +0000
267 | summary: c
268 |
269 o changeset: 1:ef3a871183d7
270 | user: test
271 | date: Thu Jan 01 00:00:00 1970 +0000
272 | summary: b
273 |
274 o changeset: 0:9ab35a2d17cb
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: a
61
278
62 hg up
279 $ restore
63 hg glog
280 $ hg glog
64 echo % 2 is parent of 3, only one strip should happen
281 o changeset: 4:443431ffac4f
65 hg strip 2 3 | hidebackup
282 | tag: tip
66 hg glog
283 | user: test
67 restore
284 | date: Thu Jan 01 00:00:00 1970 +0000
68 hg glog
285 | summary: e
69 echo % 2 different branches: 2 strips
286 |
70 hg strip 2 4 | hidebackup
287 o changeset: 3:65bd5f99a4a3
71 hg glog
288 | parent: 1:ef3a871183d7
72 restore
289 | user: test
73 echo % 2 different branches and a common ancestor: 1 strip
290 | date: Thu Jan 01 00:00:00 1970 +0000
74 hg strip 1 2 4 | hidebackup
291 | summary: d
75 restore
292 |
293 | @ changeset: 2:264128213d29
294 |/ user: test
295 | date: Thu Jan 01 00:00:00 1970 +0000
296 | summary: c
297 |
298 o changeset: 1:ef3a871183d7
299 | user: test
300 | date: Thu Jan 01 00:00:00 1970 +0000
301 | summary: b
302 |
303 o changeset: 0:9ab35a2d17cb
304 user: test
305 date: Thu Jan 01 00:00:00 1970 +0000
306 summary: a
307
308
309 2 different branches: 2 strips
76
310
77 # remove branchy history for qimport tests
311 $ hg strip 2 4
78 hg strip 3 | hidebackup
312 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 saved backup bundle to .*
314 saved backup bundle to .*
315 $ hg glog
316 @ changeset: 2:65bd5f99a4a3
317 | tag: tip
318 | user: test
319 | date: Thu Jan 01 00:00:00 1970 +0000
320 | summary: d
321 |
322 o changeset: 1:ef3a871183d7
323 | user: test
324 | date: Thu Jan 01 00:00:00 1970 +0000
325 | summary: b
326 |
327 o changeset: 0:9ab35a2d17cb
328 user: test
329 date: Thu Jan 01 00:00:00 1970 +0000
330 summary: a
331
332 $ restore
333
334 2 different branches and a common ancestor: 1 strip
335
336 $ hg strip 1 2 4
337 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 saved backup bundle to .*
339 $ restore
340
341
342 remove branchy history for qimport tests
343
344 $ hg strip 3
345 saved backup bundle to .*
79
346
80 #strip of applied mq should cleanup status file
347
81 hg up -C 3
348 strip of applied mq should cleanup status file
82 echo fooagain >> bar
349
83 hg ci -mf
350 $ hg up -C 3
84 hg qimport -r tip:2
351 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 echo % applied patches before strip
352 $ echo fooagain >> bar
86 hg qapplied
353 $ hg ci -mf
87 echo % stripping revision in queue
354 $ hg qimport -r tip:2
88 hg strip 3 | hidebackup
355
89 echo % applied patches after stripping rev in queue
356 applied patches before strip
90 hg qapplied
357
91 echo % stripping ancestor of queue
358 $ hg qapplied
92 hg strip 1 | hidebackup
359 2.diff
93 echo % applied patches after stripping ancestor of queue
360 3.diff
94 hg qapplied
361 4.diff
362
363 stripping revision in queue
364
365 $ hg strip 3
366 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 saved backup bundle to .*
368
369 applied patches after stripping rev in queue
370
371 $ hg qapplied
372 2.diff
373
374 stripping ancestor of queue
375
376 $ hg strip 1
377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
378 saved backup bundle to .*
379
380 applied patches after stripping ancestor of queue
381
382 $ hg qapplied
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now