##// 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
2
4
3 . $TESTDIR/helpers.sh
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 > }
18
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
4
31
5 echo "[extensions]" >> $HGRCPATH
32 $ hg up 1
6 echo "mq=" >> $HGRCPATH
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
7 echo "graphlog=" >> $HGRCPATH
34 $ echo blah >> bar
35 $ hg ci -Amd
36 created new head
37
38 $ echo final >> bar
39 $ hg ci -Ame
40
41 $ hg log
42 changeset: 4:443431ffac4f
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
8
69
9 restore() {
70 $ teststrip 4 4
10 hg unbundle -q .hg/strip-backup/*
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 rm .hg/strip-backup/*
72 % before update 4, strip 4
12 }
73 changeset: 4:443431ffac4f
13 teststrip() {
74 tag: tip
14 hg up -C $1
75 user: test
15 echo % before update $1, strip $2
76 date: Thu Jan 01 00:00:00 1970 +0000
16 hg parents
77 summary: e
17 hg --traceback strip $2 | hidebackup
78
18 echo % after update $1, strip $2
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 hg parents
80 saved backup bundle to .*
20 restore
81 % after update 4, strip 4
21 }
82 changeset: 3:65bd5f99a4a3
22
83 tag: tip
23 hg init test
84 parent: 1:ef3a871183d7
24 cd test
85 user: test
86 date: Thu Jan 01 00:00:00 1970 +0000
87 summary: d
88
89 $ teststrip 4 3
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 % before update 4, strip 3
92 changeset: 4:443431ffac4f
93 tag: tip
94 user: test
95 date: Thu Jan 01 00:00:00 1970 +0000
96 summary: e
97
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 saved backup bundle to .*
100 % after update 4, strip 3
101 changeset: 1:ef3a871183d7
102 user: test
103 date: Thu Jan 01 00:00:00 1970 +0000
104 summary: b
105
106 $ teststrip 1 4
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
137
138 $ teststrip 4 1
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
147
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
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
156
157 $ teststrip null 4
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
25
162
26 echo foo > bar
163 $ hg log
27 hg ci -Ama
164 changeset: 4:264128213d29
28
165 tag: tip
29 echo more >> bar
166 parent: 1:ef3a871183d7
30 hg ci -Amb
167 user: test
31
168 date: Thu Jan 01 00:00:00 1970 +0000
32 echo blah >> bar
169 summary: c
33 hg ci -Amc
170
34
171 changeset: 3:443431ffac4f
35 hg up 1
172 user: test
36 echo blah >> bar
173 date: Thu Jan 01 00:00:00 1970 +0000
37 hg ci -Amd
174 summary: e
38
175
39 echo final >> bar
176 changeset: 2:65bd5f99a4a3
40 hg ci -Ame
177 user: test
41
178 date: Thu Jan 01 00:00:00 1970 +0000
42 hg log
179 summary: d
180
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
50
199
51 hg log
200 $ hg parents
201 changeset: 2:65bd5f99a4a3
202 user: test
203 date: Thu Jan 01 00:00:00 1970 +0000
204 summary: d
205
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
52
218
53 hg up -C 2
219 $ hg parents
54 hg merge 4
220 changeset: 1:ef3a871183d7
55 echo % before strip of merge parent
221 user: test
56 hg parents
222 date: Thu Jan 01 00:00:00 1970 +0000
57 hg strip 4 2>&1 | hidebackup
223 summary: b
58 echo % after strip of merge parent
224
59 hg parents
225 $ restore
60 restore
226
227 $ hg up
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 $ hg glog
230 @ changeset: 4:264128213d29
231 | tag: tip
232 | parent: 1:ef3a871183d7
233 | user: test
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
61
259
62 hg up
260 $ hg strip 2 3
63 hg glog
261 saved backup bundle to .*
64 echo % 2 is parent of 3, only one strip should happen
262 $ hg glog
65 hg strip 2 3 | hidebackup
263 @ changeset: 2:264128213d29
66 hg glog
264 | tag: tip
67 restore
265 | user: test
68 hg glog
266 | date: Thu Jan 01 00:00:00 1970 +0000
69 echo % 2 different branches: 2 strips
267 | summary: c
70 hg strip 2 4 | hidebackup
268 |
71 hg glog
269 o changeset: 1:ef3a871183d7
72 restore
270 | user: test
73 echo % 2 different branches and a common ancestor: 1 strip
271 | date: Thu Jan 01 00:00:00 1970 +0000
74 hg strip 1 2 4 | hidebackup
272 | summary: b
75 restore
273 |
274 o changeset: 0:9ab35a2d17cb
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: a
278
279 $ restore
280 $ hg glog
281 o changeset: 4:443431ffac4f
282 | tag: tip
283 | user: test
284 | date: Thu Jan 01 00:00:00 1970 +0000
285 | summary: e
286 |
287 o changeset: 3:65bd5f99a4a3
288 | parent: 1:ef3a871183d7
289 | user: test
290 | date: Thu Jan 01 00:00:00 1970 +0000
291 | summary: d
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