##// 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
6 echo "mq=" >> $HGRCPATH
7 echo "graphlog=" >> $HGRCPATH
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
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() {
10 hg unbundle -q .hg/strip-backup/*
11 rm .hg/strip-backup/*
12 }
13 teststrip() {
14 hg up -C $1
15 echo % before update $1, strip $2
16 hg parents
17 hg --traceback strip $2 | hidebackup
18 echo % after update $1, strip $2
19 hg parents
20 restore
21 }
22
23 hg init test
24 cd test
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
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
27 hg ci -Ama
28
29 echo more >> bar
30 hg ci -Amb
31
32 echo blah >> bar
33 hg ci -Amc
34
35 hg up 1
36 echo blah >> bar
37 hg ci -Amd
38
39 echo final >> bar
40 hg ci -Ame
41
42 hg log
163 $ hg log
164 changeset: 4:264128213d29
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
175
176 changeset: 2:65bd5f99a4a3
177 user: test
178 date: Thu Jan 01 00:00:00 1970 +0000
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
45 teststrip 4 3
46 teststrip 1 4
47 teststrip 4 2
48 teststrip 4 1
49 teststrip null 4
192 $ hg up -C 2
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 $ hg merge 4
195 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 (branch merge, don't forget to commit)
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
54 hg merge 4
55 echo % before strip of merge parent
56 hg parents
57 hg strip 4 2>&1 | hidebackup
58 echo % after strip of merge parent
59 hg parents
60 restore
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
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
63 hg glog
64 echo % 2 is parent of 3, only one strip should happen
65 hg strip 2 3 | hidebackup
66 hg glog
67 restore
68 hg glog
69 echo % 2 different branches: 2 strips
70 hg strip 2 4 | hidebackup
71 hg glog
72 restore
73 echo % 2 different branches and a common ancestor: 1 strip
74 hg strip 1 2 4 | hidebackup
75 restore
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
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
78 hg strip 3 | hidebackup
311 $ hg strip 2 4
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
81 hg up -C 3
82 echo fooagain >> bar
83 hg ci -mf
84 hg qimport -r tip:2
85 echo % applied patches before strip
86 hg qapplied
87 echo % stripping revision in queue
88 hg strip 3 | hidebackup
89 echo % applied patches after stripping rev in queue
90 hg qapplied
91 echo % stripping ancestor of queue
92 hg strip 1 | hidebackup
93 echo % applied patches after stripping ancestor of queue
94 hg qapplied
347
348 strip of applied mq should cleanup status file
349
350 $ hg up -C 3
351 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 $ echo fooagain >> bar
353 $ hg ci -mf
354 $ hg qimport -r tip:2
355
356 applied patches before strip
357
358 $ hg qapplied
359 2.diff
360 3.diff
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
General Comments 0
You need to be logged in to leave comments. Login now