comparison tests/test-mq-qrefresh.t @ 12324:b701610f6c56

tests: unify some of test-mq*
author Adrian Buehlmann <adrian@cadifra.com>
date Sun, 19 Sep 2010 23:42:18 +0200
parents tests/test-mq-qrefresh@8cb81d75730c
children 02990e22150b
comparison
equal deleted inserted replaced
12318:d643ae555a4d 12324:b701610f6c56
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[diff]" >> $HGRCPATH
4 $ echo "nodates=1" >> $HGRCPATH
5
6 $ hg init a
7 $ cd a
8
9 $ mkdir 1 2
10 $ echo 'base' > 1/base
11 $ echo 'base' > 2/base
12 $ hg ci -Ambase
13 adding 1/base
14 adding 2/base
15
16 $ hg qnew -mmqbase mqbase
17
18 $ echo 'patched' > 1/base
19 $ echo 'patched' > 2/base
20 $ hg qrefresh
21
22 $ hg qdiff
23 diff -r e7af5904b465 1/base
24 --- a/1/base
25 +++ b/1/base
26 @@ -1,1 +1,1 @@
27 -base
28 +patched
29 diff -r e7af5904b465 2/base
30 --- a/2/base
31 +++ b/2/base
32 @@ -1,1 +1,1 @@
33 -base
34 +patched
35
36 $ hg qdiff .
37 diff -r e7af5904b465 1/base
38 --- a/1/base
39 +++ b/1/base
40 @@ -1,1 +1,1 @@
41 -base
42 +patched
43 diff -r e7af5904b465 2/base
44 --- a/2/base
45 +++ b/2/base
46 @@ -1,1 +1,1 @@
47 -base
48 +patched
49
50 $ cat .hg/patches/mqbase
51 # HG changeset patch
52 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
53 mqbase
54
55 diff -r e7af5904b465 1/base
56 --- a/1/base
57 +++ b/1/base
58 @@ -1,1 +1,1 @@
59 -base
60 +patched
61 diff -r e7af5904b465 2/base
62 --- a/2/base
63 +++ b/2/base
64 @@ -1,1 +1,1 @@
65 -base
66 +patched
67
68 $ echo 'patched again' > base
69 $ hg qrefresh 1
70
71 $ hg qdiff
72 diff -r e7af5904b465 1/base
73 --- a/1/base
74 +++ b/1/base
75 @@ -1,1 +1,1 @@
76 -base
77 +patched
78 diff -r e7af5904b465 2/base
79 --- a/2/base
80 +++ b/2/base
81 @@ -1,1 +1,1 @@
82 -base
83 +patched
84
85 $ hg qdiff .
86 diff -r e7af5904b465 1/base
87 --- a/1/base
88 +++ b/1/base
89 @@ -1,1 +1,1 @@
90 -base
91 +patched
92 diff -r e7af5904b465 2/base
93 --- a/2/base
94 +++ b/2/base
95 @@ -1,1 +1,1 @@
96 -base
97 +patched
98
99 $ cat .hg/patches/mqbase
100 # HG changeset patch
101 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
102 mqbase
103
104 diff -r e7af5904b465 1/base
105 --- a/1/base
106 +++ b/1/base
107 @@ -1,1 +1,1 @@
108 -base
109 +patched
110
111 qrefresh . in subdir:
112
113 $ ( cd 1 ; hg qrefresh . )
114
115 $ hg qdiff
116 diff -r e7af5904b465 1/base
117 --- a/1/base
118 +++ b/1/base
119 @@ -1,1 +1,1 @@
120 -base
121 +patched
122 diff -r e7af5904b465 2/base
123 --- a/2/base
124 +++ b/2/base
125 @@ -1,1 +1,1 @@
126 -base
127 +patched
128
129 $ hg qdiff .
130 diff -r e7af5904b465 1/base
131 --- a/1/base
132 +++ b/1/base
133 @@ -1,1 +1,1 @@
134 -base
135 +patched
136 diff -r e7af5904b465 2/base
137 --- a/2/base
138 +++ b/2/base
139 @@ -1,1 +1,1 @@
140 -base
141 +patched
142
143 $ cat .hg/patches/mqbase
144 # HG changeset patch
145 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
146 mqbase
147
148 diff -r e7af5904b465 1/base
149 --- a/1/base
150 +++ b/1/base
151 @@ -1,1 +1,1 @@
152 -base
153 +patched
154
155 qrefresh in hg-root again:
156
157 $ hg qrefresh
158
159 $ hg qdiff
160 diff -r e7af5904b465 1/base
161 --- a/1/base
162 +++ b/1/base
163 @@ -1,1 +1,1 @@
164 -base
165 +patched
166 diff -r e7af5904b465 2/base
167 --- a/2/base
168 +++ b/2/base
169 @@ -1,1 +1,1 @@
170 -base
171 +patched
172
173 $ hg qdiff .
174 diff -r e7af5904b465 1/base
175 --- a/1/base
176 +++ b/1/base
177 @@ -1,1 +1,1 @@
178 -base
179 +patched
180 diff -r e7af5904b465 2/base
181 --- a/2/base
182 +++ b/2/base
183 @@ -1,1 +1,1 @@
184 -base
185 +patched
186
187 $ cat .hg/patches/mqbase
188 # HG changeset patch
189 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
190 mqbase
191
192 diff -r e7af5904b465 1/base
193 --- a/1/base
194 +++ b/1/base
195 @@ -1,1 +1,1 @@
196 -base
197 +patched
198 diff -r e7af5904b465 2/base
199 --- a/2/base
200 +++ b/2/base
201 @@ -1,1 +1,1 @@
202 -base
203 +patched
204
205
206 qrefresh --short tests:
207
208 $ echo 'orphan' > orphanchild
209 $ hg add orphanchild
210 $ hg qrefresh nonexistingfilename # clear patch
211 $ hg qrefresh --short 1/base
212 $ hg qrefresh --short 2/base
213
214 $ hg qdiff
215 diff -r e7af5904b465 1/base
216 --- a/1/base
217 +++ b/1/base
218 @@ -1,1 +1,1 @@
219 -base
220 +patched
221 diff -r e7af5904b465 2/base
222 --- a/2/base
223 +++ b/2/base
224 @@ -1,1 +1,1 @@
225 -base
226 +patched
227 diff -r e7af5904b465 orphanchild
228 --- /dev/null
229 +++ b/orphanchild
230 @@ -0,0 +1,1 @@
231 +orphan
232
233 $ cat .hg/patches/mqbase
234 # HG changeset patch
235 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
236 mqbase
237
238 diff -r e7af5904b465 1/base
239 --- a/1/base
240 +++ b/1/base
241 @@ -1,1 +1,1 @@
242 -base
243 +patched
244 diff -r e7af5904b465 2/base
245 --- a/2/base
246 +++ b/2/base
247 @@ -1,1 +1,1 @@
248 -base
249 +patched
250
251 $ hg st
252 A orphanchild
253 ? base
254
255 diff shows what is not in patch:
256
257 $ hg diff
258 diff -r ............ orphanchild
259 --- /dev/null
260 +++ b/orphanchild
261 @@ -0,0 +1,1 @@
262 +orphan
263
264 Before starting exclusive tests:
265
266 $ cat .hg/patches/mqbase
267 # HG changeset patch
268 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
269 mqbase
270
271 diff -r e7af5904b465 1/base
272 --- a/1/base
273 +++ b/1/base
274 @@ -1,1 +1,1 @@
275 -base
276 +patched
277 diff -r e7af5904b465 2/base
278 --- a/2/base
279 +++ b/2/base
280 @@ -1,1 +1,1 @@
281 -base
282 +patched
283
284 Exclude 2/base:
285
286 $ hg qref -s -X 2/base
287
288 $ cat .hg/patches/mqbase
289 # HG changeset patch
290 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
291 mqbase
292
293 diff -r e7af5904b465 1/base
294 --- a/1/base
295 +++ b/1/base
296 @@ -1,1 +1,1 @@
297 -base
298 +patched
299
300 status shows 2/base as dirty:
301
302 $ hg status
303 M 2/base
304 A orphanchild
305 ? base
306
307 Remove 1/base and add 2/base again but not orphanchild:
308
309 $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild
310
311 $ cat .hg/patches/mqbase
312 # HG changeset patch
313 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
314 mqbase
315
316 diff -r e7af5904b465 2/base
317 --- a/2/base
318 +++ b/2/base
319 @@ -1,1 +1,1 @@
320 -base
321 +patched
322
323 Add 1/base with include filter - and thus remove 2/base from patch:
324
325 $ hg qref -s -I 1/ o* */*
326
327 $ cat .hg/patches/mqbase
328 # HG changeset patch
329 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
330 mqbase
331
332 diff -r e7af5904b465 1/base
333 --- a/1/base
334 +++ b/1/base
335 @@ -1,1 +1,1 @@
336 -base
337 +patched
338
339 $ cd ..
340
341
342 Test qrefresh --git losing copy metadata:
343
344 $ hg init repo
345 $ cd repo
346
347 $ echo "[diff]" >> .hg/hgrc
348 $ echo "git=True" >> .hg/hgrc
349 $ echo a > a
350
351 $ hg ci -Am adda
352 adding a
353 $ hg copy a ab
354 $ echo b >> ab
355 $ hg copy a ac
356 $ echo c >> ac
357
358 Capture changes:
359
360 $ hg qnew -f p1
361
362 $ hg qdiff
363 diff --git a/a b/ab
364 copy from a
365 copy to ab
366 --- a/a
367 +++ b/ab
368 @@ -1,1 +1,2 @@
369 a
370 +b
371 diff --git a/a b/ac
372 copy from a
373 copy to ac
374 --- a/a
375 +++ b/ac
376 @@ -1,1 +1,2 @@
377 a
378 +c
379
380 Refresh and check changes again:
381
382 $ hg qrefresh
383
384 $ hg qdiff
385 diff --git a/a b/ab
386 copy from a
387 copy to ab
388 --- a/a
389 +++ b/ab
390 @@ -1,1 +1,2 @@
391 a
392 +b
393 diff --git a/a b/ac
394 copy from a
395 copy to ac
396 --- a/a
397 +++ b/ac
398 @@ -1,1 +1,2 @@
399 a
400 +c
401
402 $ cd ..
403
404
405 Test issue 1441: qrefresh confused after hg rename:
406
407 $ hg init repo-1441
408 $ cd repo-1441
409 $ echo a > a
410 $ hg add a
411 $ hg qnew -f p
412 $ hg mv a b
413 $ hg qrefresh
414
415 $ hg qdiff
416 diff -r 000000000000 b
417 --- /dev/null
418 +++ b/b
419 @@ -0,0 +1,1 @@
420 +a
421
422 $ cd ..
423
424
425 Issue2025: qrefresh does not honor filtering options when tip != qtip:
426
427 $ hg init repo-2025
428 $ cd repo-2025
429 $ echo a > a
430 $ echo b > b
431 $ hg ci -qAm addab
432 $ echo a >> a
433 $ echo b >> b
434 $ hg qnew -f patch
435 $ hg up -qC 0
436 $ echo c > c
437 $ hg ci -qAm addc
438 $ hg up -qC 1
439
440 refresh with tip != qtip:
441
442 $ hg --config diff.nodates=1 qrefresh -I b
443
444 $ hg st
445 M a
446
447 $ cat b
448 b
449 b
450
451 $ cat .hg/patches/patch
452 # HG changeset patch
453 # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
454
455 diff -r 1a60229be7ac b
456 --- a/b
457 +++ b/b
458 @@ -1,1 +1,2 @@
459 b
460 +b
461
462 $ cd ..
463
464
465 Issue1441 with git patches:
466
467 $ hg init repo-1441-git
468 $ cd repo-1441-git
469
470 $ echo "[diff]" >> .hg/hgrc
471 $ echo "git=True" >> .hg/hgrc
472
473 $ echo a > a
474 $ hg add a
475 $ hg qnew -f p
476 $ hg mv a b
477 $ hg qrefresh
478
479 $ hg qdiff --nodates
480 diff --git a/b b/b
481 new file mode 100644
482 --- /dev/null
483 +++ b/b
484 @@ -0,0 +1,1 @@
485 +a
486
487 $ cd ..
488