##// END OF EJS Templates
test-mq-qrefresh: test that the patch at qtip is indeed empty...
Adrian Buehlmann -
r17978:55b367bf default
parent child Browse files
Show More
@@ -1,547 +1,548 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "mq=" >> $HGRCPATH
3 3 $ echo "[diff]" >> $HGRCPATH
4 4 $ echo "nodates=1" >> $HGRCPATH
5 5
6 6 $ hg init a
7 7 $ cd a
8 8
9 9 $ mkdir 1 2
10 10 $ echo 'base' > 1/base
11 11 $ echo 'base' > 2/base
12 12 $ hg ci -Ambase
13 13 adding 1/base
14 14 adding 2/base
15 15
16 16 $ hg qnew -mmqbase mqbase
17 17
18 18 $ echo 'patched' > 1/base
19 19 $ echo 'patched' > 2/base
20 20 $ hg qrefresh
21 21
22 22 $ hg qdiff
23 23 diff -r e7af5904b465 1/base
24 24 --- a/1/base
25 25 +++ b/1/base
26 26 @@ -1,1 +1,1 @@
27 27 -base
28 28 +patched
29 29 diff -r e7af5904b465 2/base
30 30 --- a/2/base
31 31 +++ b/2/base
32 32 @@ -1,1 +1,1 @@
33 33 -base
34 34 +patched
35 35
36 36 $ hg qdiff .
37 37 diff -r e7af5904b465 1/base
38 38 --- a/1/base
39 39 +++ b/1/base
40 40 @@ -1,1 +1,1 @@
41 41 -base
42 42 +patched
43 43 diff -r e7af5904b465 2/base
44 44 --- a/2/base
45 45 +++ b/2/base
46 46 @@ -1,1 +1,1 @@
47 47 -base
48 48 +patched
49 49
50 50 $ cat .hg/patches/mqbase
51 51 # HG changeset patch
52 52 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
53 53 mqbase
54 54
55 55 diff -r e7af5904b465 1/base
56 56 --- a/1/base
57 57 +++ b/1/base
58 58 @@ -1,1 +1,1 @@
59 59 -base
60 60 +patched
61 61 diff -r e7af5904b465 2/base
62 62 --- a/2/base
63 63 +++ b/2/base
64 64 @@ -1,1 +1,1 @@
65 65 -base
66 66 +patched
67 67
68 68 $ echo 'patched again' > base
69 69 $ hg qrefresh 1
70 70
71 71 $ hg qdiff
72 72 diff -r e7af5904b465 1/base
73 73 --- a/1/base
74 74 +++ b/1/base
75 75 @@ -1,1 +1,1 @@
76 76 -base
77 77 +patched
78 78 diff -r e7af5904b465 2/base
79 79 --- a/2/base
80 80 +++ b/2/base
81 81 @@ -1,1 +1,1 @@
82 82 -base
83 83 +patched
84 84
85 85 $ hg qdiff .
86 86 diff -r e7af5904b465 1/base
87 87 --- a/1/base
88 88 +++ b/1/base
89 89 @@ -1,1 +1,1 @@
90 90 -base
91 91 +patched
92 92 diff -r e7af5904b465 2/base
93 93 --- a/2/base
94 94 +++ b/2/base
95 95 @@ -1,1 +1,1 @@
96 96 -base
97 97 +patched
98 98
99 99 $ cat .hg/patches/mqbase
100 100 # HG changeset patch
101 101 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
102 102 mqbase
103 103
104 104 diff -r e7af5904b465 1/base
105 105 --- a/1/base
106 106 +++ b/1/base
107 107 @@ -1,1 +1,1 @@
108 108 -base
109 109 +patched
110 110
111 111 qrefresh . in subdir:
112 112
113 113 $ ( cd 1 ; hg qrefresh . )
114 114
115 115 $ hg qdiff
116 116 diff -r e7af5904b465 1/base
117 117 --- a/1/base
118 118 +++ b/1/base
119 119 @@ -1,1 +1,1 @@
120 120 -base
121 121 +patched
122 122 diff -r e7af5904b465 2/base
123 123 --- a/2/base
124 124 +++ b/2/base
125 125 @@ -1,1 +1,1 @@
126 126 -base
127 127 +patched
128 128
129 129 $ hg qdiff .
130 130 diff -r e7af5904b465 1/base
131 131 --- a/1/base
132 132 +++ b/1/base
133 133 @@ -1,1 +1,1 @@
134 134 -base
135 135 +patched
136 136 diff -r e7af5904b465 2/base
137 137 --- a/2/base
138 138 +++ b/2/base
139 139 @@ -1,1 +1,1 @@
140 140 -base
141 141 +patched
142 142
143 143 $ cat .hg/patches/mqbase
144 144 # HG changeset patch
145 145 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
146 146 mqbase
147 147
148 148 diff -r e7af5904b465 1/base
149 149 --- a/1/base
150 150 +++ b/1/base
151 151 @@ -1,1 +1,1 @@
152 152 -base
153 153 +patched
154 154
155 155 qrefresh in hg-root again:
156 156
157 157 $ hg qrefresh
158 158
159 159 $ hg qdiff
160 160 diff -r e7af5904b465 1/base
161 161 --- a/1/base
162 162 +++ b/1/base
163 163 @@ -1,1 +1,1 @@
164 164 -base
165 165 +patched
166 166 diff -r e7af5904b465 2/base
167 167 --- a/2/base
168 168 +++ b/2/base
169 169 @@ -1,1 +1,1 @@
170 170 -base
171 171 +patched
172 172
173 173 $ hg qdiff .
174 174 diff -r e7af5904b465 1/base
175 175 --- a/1/base
176 176 +++ b/1/base
177 177 @@ -1,1 +1,1 @@
178 178 -base
179 179 +patched
180 180 diff -r e7af5904b465 2/base
181 181 --- a/2/base
182 182 +++ b/2/base
183 183 @@ -1,1 +1,1 @@
184 184 -base
185 185 +patched
186 186
187 187 $ cat .hg/patches/mqbase
188 188 # HG changeset patch
189 189 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
190 190 mqbase
191 191
192 192 diff -r e7af5904b465 1/base
193 193 --- a/1/base
194 194 +++ b/1/base
195 195 @@ -1,1 +1,1 @@
196 196 -base
197 197 +patched
198 198 diff -r e7af5904b465 2/base
199 199 --- a/2/base
200 200 +++ b/2/base
201 201 @@ -1,1 +1,1 @@
202 202 -base
203 203 +patched
204 204
205 205
206 206 qrefresh --short tests:
207 207
208 208 $ echo 'orphan' > orphanchild
209 209 $ hg add orphanchild
210 210 $ hg qrefresh nonexistentfilename # clear patch
211 211 nonexistentfilename: * (glob)
212 $ hg diff -c qtip
212 213 $ hg qrefresh --short 1/base
213 214 $ hg qrefresh --short 2/base
214 215
215 216 $ hg qdiff
216 217 diff -r e7af5904b465 1/base
217 218 --- a/1/base
218 219 +++ b/1/base
219 220 @@ -1,1 +1,1 @@
220 221 -base
221 222 +patched
222 223 diff -r e7af5904b465 2/base
223 224 --- a/2/base
224 225 +++ b/2/base
225 226 @@ -1,1 +1,1 @@
226 227 -base
227 228 +patched
228 229 diff -r e7af5904b465 orphanchild
229 230 --- /dev/null
230 231 +++ b/orphanchild
231 232 @@ -0,0 +1,1 @@
232 233 +orphan
233 234
234 235 $ cat .hg/patches/mqbase
235 236 # HG changeset patch
236 237 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
237 238 mqbase
238 239
239 240 diff -r e7af5904b465 1/base
240 241 --- a/1/base
241 242 +++ b/1/base
242 243 @@ -1,1 +1,1 @@
243 244 -base
244 245 +patched
245 246 diff -r e7af5904b465 2/base
246 247 --- a/2/base
247 248 +++ b/2/base
248 249 @@ -1,1 +1,1 @@
249 250 -base
250 251 +patched
251 252
252 253 $ hg st
253 254 A orphanchild
254 255 ? base
255 256
256 257 diff shows what is not in patch:
257 258
258 259 $ hg diff
259 260 diff -r ???????????? orphanchild (glob)
260 261 --- /dev/null
261 262 +++ b/orphanchild
262 263 @@ -0,0 +1,1 @@
263 264 +orphan
264 265
265 266 Before starting exclusive tests:
266 267
267 268 $ cat .hg/patches/mqbase
268 269 # HG changeset patch
269 270 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
270 271 mqbase
271 272
272 273 diff -r e7af5904b465 1/base
273 274 --- a/1/base
274 275 +++ b/1/base
275 276 @@ -1,1 +1,1 @@
276 277 -base
277 278 +patched
278 279 diff -r e7af5904b465 2/base
279 280 --- a/2/base
280 281 +++ b/2/base
281 282 @@ -1,1 +1,1 @@
282 283 -base
283 284 +patched
284 285
285 286 Exclude 2/base:
286 287
287 288 $ hg qref -s -X 2/base
288 289
289 290 $ cat .hg/patches/mqbase
290 291 # HG changeset patch
291 292 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
292 293 mqbase
293 294
294 295 diff -r e7af5904b465 1/base
295 296 --- a/1/base
296 297 +++ b/1/base
297 298 @@ -1,1 +1,1 @@
298 299 -base
299 300 +patched
300 301
301 302 status shows 2/base as dirty:
302 303
303 304 $ hg status
304 305 M 2/base
305 306 A orphanchild
306 307 ? base
307 308
308 309 Remove 1/base and add 2/base again but not orphanchild:
309 310
310 311 $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild
311 312
312 313 $ cat .hg/patches/mqbase
313 314 # HG changeset patch
314 315 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
315 316 mqbase
316 317
317 318 diff -r e7af5904b465 2/base
318 319 --- a/2/base
319 320 +++ b/2/base
320 321 @@ -1,1 +1,1 @@
321 322 -base
322 323 +patched
323 324
324 325 Add 1/base with include filter - and thus remove 2/base from patch:
325 326
326 327 $ hg qref -s -I 1/ o* */*
327 328
328 329 $ cat .hg/patches/mqbase
329 330 # HG changeset patch
330 331 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
331 332 mqbase
332 333
333 334 diff -r e7af5904b465 1/base
334 335 --- a/1/base
335 336 +++ b/1/base
336 337 @@ -1,1 +1,1 @@
337 338 -base
338 339 +patched
339 340
340 341 $ cd ..
341 342
342 343
343 344 Test qrefresh --git losing copy metadata:
344 345
345 346 $ hg init repo
346 347 $ cd repo
347 348
348 349 $ echo "[diff]" >> .hg/hgrc
349 350 $ echo "git=True" >> .hg/hgrc
350 351 $ echo a > a
351 352
352 353 $ hg ci -Am adda
353 354 adding a
354 355 $ hg copy a ab
355 356 $ echo b >> ab
356 357 $ hg copy a ac
357 358 $ echo c >> ac
358 359
359 360 Capture changes:
360 361
361 362 $ hg qnew -f p1
362 363
363 364 $ hg qdiff
364 365 diff --git a/a b/ab
365 366 copy from a
366 367 copy to ab
367 368 --- a/a
368 369 +++ b/ab
369 370 @@ -1,1 +1,2 @@
370 371 a
371 372 +b
372 373 diff --git a/a b/ac
373 374 copy from a
374 375 copy to ac
375 376 --- a/a
376 377 +++ b/ac
377 378 @@ -1,1 +1,2 @@
378 379 a
379 380 +c
380 381
381 382 Refresh and check changes again:
382 383
383 384 $ hg qrefresh
384 385
385 386 $ hg qdiff
386 387 diff --git a/a b/ab
387 388 copy from a
388 389 copy to ab
389 390 --- a/a
390 391 +++ b/ab
391 392 @@ -1,1 +1,2 @@
392 393 a
393 394 +b
394 395 diff --git a/a b/ac
395 396 copy from a
396 397 copy to ac
397 398 --- a/a
398 399 +++ b/ac
399 400 @@ -1,1 +1,2 @@
400 401 a
401 402 +c
402 403
403 404 $ cd ..
404 405
405 406
406 407 Issue1441: qrefresh confused after hg rename:
407 408
408 409 $ hg init repo-1441
409 410 $ cd repo-1441
410 411 $ echo a > a
411 412 $ hg add a
412 413 $ hg qnew -f p
413 414 $ hg mv a b
414 415 $ hg qrefresh
415 416
416 417 $ hg qdiff
417 418 diff -r 000000000000 b
418 419 --- /dev/null
419 420 +++ b/b
420 421 @@ -0,0 +1,1 @@
421 422 +a
422 423
423 424 $ cd ..
424 425
425 426
426 427 Issue2025: qrefresh does not honor filtering options when tip !=
427 428 qtip:
428 429
429 430 $ hg init repo-2025
430 431 $ cd repo-2025
431 432 $ echo a > a
432 433 $ echo b > b
433 434 $ hg ci -qAm addab
434 435 $ echo a >> a
435 436 $ echo b >> b
436 437 $ hg qnew -f patch
437 438 $ hg up -qC 0
438 439 $ echo c > c
439 440 $ hg ci -qAm addc
440 441 $ hg up -qC 1
441 442
442 443 refresh with tip != qtip:
443 444
444 445 $ hg --config diff.nodates=1 qrefresh -I b
445 446
446 447 $ hg st
447 448 M a
448 449
449 450 $ cat b
450 451 b
451 452 b
452 453
453 454 $ cat .hg/patches/patch
454 455 # HG changeset patch
455 456 # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
456 457
457 458 diff -r 1a60229be7ac b
458 459 --- a/b
459 460 +++ b/b
460 461 @@ -1,1 +1,2 @@
461 462 b
462 463 +b
463 464
464 465 $ cd ..
465 466
466 467
467 468 Issue1441 with git patches:
468 469
469 470 $ hg init repo-1441-git
470 471 $ cd repo-1441-git
471 472
472 473 $ echo "[diff]" >> .hg/hgrc
473 474 $ echo "git=True" >> .hg/hgrc
474 475
475 476 $ echo a > a
476 477 $ hg add a
477 478 $ hg qnew -f p
478 479 $ hg mv a b
479 480 $ hg qrefresh
480 481
481 482 $ hg qdiff --nodates
482 483 diff --git a/b b/b
483 484 new file mode 100644
484 485 --- /dev/null
485 486 +++ b/b
486 487 @@ -0,0 +1,1 @@
487 488 +a
488 489
489 490 $ cd ..
490 491
491 492 Refresh with bad usernames. Mercurial used to abort on bad usernames,
492 493 but only after writing the bad name into the patch.
493 494
494 495 $ hg init bad-usernames
495 496 $ cd bad-usernames
496 497 $ touch a
497 498 $ hg add a
498 499 $ hg qnew a
499 500 $ hg qrefresh -u 'foo
500 501 > bar'
501 502 transaction abort!
502 503 rollback completed
503 504 refresh interrupted while patch was popped! (revert --all, qpush to recover)
504 505 abort: username 'foo\nbar' contains a newline!
505 506 [255]
506 507 $ rm a
507 508 $ cat .hg/patches/a
508 509 # HG changeset patch
509 510 # Parent 0000000000000000000000000000000000000000
510 511 diff --git a/a b/a
511 512 new file mode 100644
512 513 $ hg qpush
513 514 applying a
514 515 now at: a
515 516 $ hg qrefresh -u ' '
516 517 transaction abort!
517 518 rollback completed
518 519 refresh interrupted while patch was popped! (revert --all, qpush to recover)
519 520 abort: empty username!
520 521 [255]
521 522 $ cat .hg/patches/a
522 523 # HG changeset patch
523 524 # Parent 0000000000000000000000000000000000000000
524 525 diff --git a/a b/a
525 526 new file mode 100644
526 527 $ cd ..
527 528
528 529 Refresh with phase data:
529 530
530 531
531 532
532 533 $ cd repo
533 534 $ echo 'babar' >> a
534 535 $ hg qnew -m 'update a' p2.diff
535 536 $ hg phase p2.diff
536 537 2: draft
537 538 $ echo 'beber' >> a
538 539 $ hg qref
539 540 $ hg phase p2.diff
540 541 2: draft
541 542 $ hg phase --force --secret p2.diff
542 543 $ echo 'bibir' >> a
543 544 $ hg qref
544 545 $ hg phase p2.diff
545 546 2: secret
546 547
547 548 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now