##// END OF EJS Templates
test-keyword: adapt for Windows
Adrian Buehlmann -
r17099:1c55d1ad default
parent child Browse files
Show More
@@ -1,1133 +1,1139 b''
1 $ "$TESTDIR/hghave" unix-permissions serve || exit 80
2
3 1 $ cat <<EOF >> $HGRCPATH
4 2 > [extensions]
5 3 > keyword =
6 4 > mq =
7 5 > notify =
8 6 > record =
9 7 > transplant =
10 8 > [ui]
11 9 > interactive = true
12 10 > EOF
13 11
14 12 hide outer repo
15 13 $ hg init
16 14
17 15 Run kwdemo before [keyword] files are set up
18 16 as it would succeed without uisetup otherwise
19 17
20 18 $ hg --quiet kwdemo
21 19 [extensions]
22 20 keyword =
23 21 [keyword]
24 22 demo.txt =
25 23 [keywordset]
26 24 svn = False
27 25 [keywordmaps]
28 26 Author = {author|user}
29 27 Date = {date|utcdate}
30 28 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
31 29 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
32 30 RCSFile = {file|basename},v
33 31 RCSfile = {file|basename},v
34 32 Revision = {node|short}
35 33 Source = {root}/{file},v
36 34 $Author: test $
37 35 $Date: ????/??/?? ??:??:?? $ (glob)
38 36 $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
39 37 $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
40 38 $RCSFile: demo.txt,v $
41 39 $RCSfile: demo.txt,v $
42 40 $Revision: ???????????? $ (glob)
43 41 $Source: */demo.txt,v $ (glob)
44 42
45 43 $ hg --quiet kwdemo "Branch = {branches}"
46 44 [extensions]
47 45 keyword =
48 46 [keyword]
49 47 demo.txt =
50 48 [keywordset]
51 49 svn = False
52 50 [keywordmaps]
53 51 Branch = {branches}
54 52 $Branch: demobranch $
55 53
56 54 $ cat <<EOF >> $HGRCPATH
57 55 > [keyword]
58 56 > ** =
59 57 > b = ignore
60 58 > i = ignore
61 59 > [hooks]
62 60 > EOF
63 61 $ cp $HGRCPATH $HGRCPATH.nohooks
64 62 > cat <<EOF >> $HGRCPATH
65 63 > commit=
66 64 > commit.test=cp a hooktest
67 65 > EOF
68 66
69 67 $ hg init Test-bndl
70 68 $ cd Test-bndl
71 69
72 70 kwshrink should exit silently in empty/invalid repo
73 71
74 72 $ hg kwshrink
75 73
76 74 Symlinks cannot be created on Windows.
77 75 A bundle to test this was made with:
78 76 hg init t
79 77 cd t
80 78 echo a > a
81 79 ln -s a sym
82 80 hg add sym
83 81 hg ci -m addsym -u mercurial
84 82 hg bundle --base null ../test-keyword.hg
85 83
86 84 $ hg pull -u "$TESTDIR"/bundles/test-keyword.hg
87 85 pulling from *test-keyword.hg (glob)
88 86 requesting all changes
89 87 adding changesets
90 88 adding manifests
91 89 adding file changes
92 90 added 1 changesets with 1 changes to 1 files
93 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 92
95 93 $ echo 'expand $Id$' > a
96 94 $ echo 'do not process $Id:' >> a
97 95 $ echo 'xxx $' >> a
98 96 $ echo 'ignore $Id$' > b
99 97
100 98 Output files as they were created
101 99
102 100 $ cat a b
103 101 expand $Id$
104 102 do not process $Id:
105 103 xxx $
106 104 ignore $Id$
107 105
108 106 no kwfiles
109 107
110 108 $ hg kwfiles
111 109
112 110 untracked candidates
113 111
114 112 $ hg -v kwfiles --unknown
115 113 k a
116 114
117 115 Add files and check status
118 116
119 117 $ hg addremove
120 118 adding a
121 119 adding b
122 120 $ hg status
123 121 A a
124 122 A b
125 123
126 124
127 125 Default keyword expansion including commit hook
128 126 Interrupted commit should not change state or run commit hook
129 127
130 128 $ hg --debug commit
131 129 abort: empty commit message
132 130 [255]
133 131 $ hg status
134 132 A a
135 133 A b
136 134
137 135 Commit with several checks
138 136
139 137 $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
140 138 a
141 139 b
142 140 overwriting a expanding keywords
143 141 running hook commit.test: cp a hooktest
144 142 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
145 143 $ hg status
146 144 ? hooktest
147 145 $ hg debugrebuildstate
148 146 $ hg --quiet identify
149 147 ef63ca68695b
150 148
151 149 cat files in working directory with keywords expanded
152 150
153 151 $ cat a b
154 152 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
155 153 do not process $Id:
156 154 xxx $
157 155 ignore $Id$
158 156
159 157 hg cat files and symlink, no expansion
160 158
161 159 $ hg cat sym a b && echo
162 160 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
163 161 do not process $Id:
164 162 xxx $
165 163 ignore $Id$
166 164 a
167 165
168 166 $ diff a hooktest
169 167
170 168 $ cp $HGRCPATH.nohooks $HGRCPATH
171 169 $ rm hooktest
172 170
173 171 hg status of kw-ignored binary file starting with '\1\n'
174 172
175 173 >>> open("i", "wb").write("\1\nfoo")
176 174 $ hg -q commit -Am metasep i
177 175 $ hg status
178 176 >>> open("i", "wb").write("\1\nbar")
179 177 $ hg status
180 178 M i
181 179 $ hg -q commit -m "modify metasep" i
182 180 $ hg status --rev 2:3
183 181 M i
184 182 $ touch empty
185 183 $ hg -q commit -A -m "another file"
186 184 $ hg status -A --rev 3:4 i
187 185 C i
188 186
189 187 $ hg -q strip -n 2
190 188
191 189 Test hook execution
192 190
193 191 bundle
194 192
195 193 $ hg bundle --base null ../kw.hg
196 194 2 changesets found
197 195 $ cd ..
198 196 $ hg init Test
199 197 $ cd Test
200 198
201 199 Notify on pull to check whether keywords stay as is in email
202 200 ie. if patch.diff wrapper acts as it should
203 201
204 202 $ cat <<EOF >> $HGRCPATH
205 203 > [hooks]
206 204 > incoming.notify = python:hgext.notify.hook
207 205 > [notify]
208 206 > sources = pull
209 207 > diffstat = False
210 208 > maxsubject = 15
211 209 > [reposubs]
212 210 > * = Test
213 211 > EOF
214 212
215 213 Pull from bundle and trigger notify
216 214
217 215 $ hg pull -u ../kw.hg
218 216 pulling from ../kw.hg
219 217 requesting all changes
220 218 adding changesets
221 219 adding manifests
222 220 adding file changes
223 221 added 2 changesets with 3 changes to 3 files
224 222 Content-Type: text/plain; charset="us-ascii"
225 223 MIME-Version: 1.0
226 224 Content-Transfer-Encoding: 7bit
227 225 Date: * (glob)
228 226 Subject: changeset in...
229 227 From: mercurial
230 228 X-Hg-Notification: changeset a2392c293916
231 229 Message-Id: <hg.a2392c293916*> (glob)
232 230 To: Test
233 231
234 232 changeset a2392c293916 in $TESTTMP/Test (glob)
235 233 details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
236 234 description:
237 235 addsym
238 236
239 237 diffs (6 lines):
240 238
241 239 diff -r 000000000000 -r a2392c293916 sym
242 240 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
243 241 +++ b/sym Sat Feb 09 20:25:47 2008 +0100
244 242 @@ -0,0 +1,1 @@
245 243 +a
246 244 \ No newline at end of file
247 245 Content-Type: text/plain; charset="us-ascii"
248 246 MIME-Version: 1.0
249 247 Content-Transfer-Encoding: 7bit
250 248 Date:* (glob)
251 249 Subject: changeset in...
252 250 From: User Name <user@example.com>
253 251 X-Hg-Notification: changeset ef63ca68695b
254 252 Message-Id: <hg.ef63ca68695b*> (glob)
255 253 To: Test
256 254
257 255 changeset ef63ca68695b in $TESTTMP/Test (glob)
258 256 details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
259 257 description:
260 258 absym
261 259
262 260 diffs (12 lines):
263 261
264 262 diff -r a2392c293916 -r ef63ca68695b a
265 263 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
266 264 +++ b/a Thu Jan 01 00:00:00 1970 +0000
267 265 @@ -0,0 +1,3 @@
268 266 +expand $Id$
269 267 +do not process $Id:
270 268 +xxx $
271 269 diff -r a2392c293916 -r ef63ca68695b b
272 270 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
273 271 +++ b/b Thu Jan 01 00:00:00 1970 +0000
274 272 @@ -0,0 +1,1 @@
275 273 +ignore $Id$
276 274 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 275
278 276 $ cp $HGRCPATH.nohooks $HGRCPATH
279 277
280 278 Touch files and check with status
281 279
282 280 $ touch a b
283 281 $ hg status
284 282
285 283 Update and expand
286 284
287 285 $ rm sym a b
288 286 $ hg update -C
289 287 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 288 $ cat a b
291 289 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
292 290 do not process $Id:
293 291 xxx $
294 292 ignore $Id$
295 293
296 294 Check whether expansion is filewise and file mode is preserved
297 295
298 296 $ echo '$Id$' > c
299 297 $ echo 'tests for different changenodes' >> c
298 #if unix-permissions
300 299 $ chmod 600 c
301 300 $ ls -l c | cut -b 1-10
302 301 -rw-------
302 #endif
303 303
304 304 commit file c
305 305
306 306 $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
307 307 adding c
308 #if unix-permissions
308 309 $ ls -l c | cut -b 1-10
309 310 -rw-------
311 #endif
310 312
311 313 force expansion
312 314
313 315 $ hg -v kwexpand
314 316 overwriting a expanding keywords
315 317 overwriting c expanding keywords
316 318
317 319 compare changenodes in a and c
318 320
319 321 $ cat a c
320 322 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
321 323 do not process $Id:
322 324 xxx $
323 325 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
324 326 tests for different changenodes
325 327
326 328 record
327 329
328 330 $ echo '$Id$' > r
329 331 $ hg add r
330 332
331 333 record chunk
332 334
333 >>> lines = open('a').readlines()
335 >>> lines = open('a', 'rb').readlines()
334 336 >>> lines.insert(1, 'foo\n')
335 337 >>> lines.append('bar\n')
336 >>> open('a', 'w').writelines(lines)
338 >>> open('a', 'wb').writelines(lines)
337 339 $ hg record -d '10 1' -m rectest a<<EOF
338 340 > y
339 341 > y
340 342 > n
341 343 > EOF
342 344 diff --git a/a b/a
343 345 2 hunks, 2 lines changed
344 346 examine changes to 'a'? [Ynesfdaq?]
345 347 @@ -1,3 +1,4 @@
346 348 expand $Id$
347 349 +foo
348 350 do not process $Id:
349 351 xxx $
350 352 record change 1/2 to 'a'? [Ynesfdaq?]
351 353 @@ -2,2 +3,3 @@
352 354 do not process $Id:
353 355 xxx $
354 356 +bar
355 357 record change 2/2 to 'a'? [Ynesfdaq?]
356 358
357 359 $ hg identify
358 360 5f5eb23505c3+ tip
359 361 $ hg status
360 362 M a
361 363 A r
362 364
363 365 Cat modified file a
364 366
365 367 $ cat a
366 368 expand $Id: a,v 5f5eb23505c3 1970/01/01 00:00:10 test $
367 369 foo
368 370 do not process $Id:
369 371 xxx $
370 372 bar
371 373
372 374 Diff remaining chunk
373 375
374 376 $ hg diff a
375 377 diff -r 5f5eb23505c3 a
376 378 --- a/a Thu Jan 01 00:00:09 1970 -0000
377 379 +++ b/a * (glob)
378 380 @@ -2,3 +2,4 @@
379 381 foo
380 382 do not process $Id:
381 383 xxx $
382 384 +bar
383 385
384 386 $ hg rollback
385 387 repository tip rolled back to revision 2 (undo commit)
386 388 working directory now based on revision 2
387 389
388 390 Record all chunks in file a
389 391
390 392 $ echo foo > msg
391 393
392 394 - do not use "hg record -m" here!
393 395
394 396 $ hg record -l msg -d '11 1' a<<EOF
395 397 > y
396 398 > y
397 399 > y
398 400 > EOF
399 401 diff --git a/a b/a
400 402 2 hunks, 2 lines changed
401 403 examine changes to 'a'? [Ynesfdaq?]
402 404 @@ -1,3 +1,4 @@
403 405 expand $Id$
404 406 +foo
405 407 do not process $Id:
406 408 xxx $
407 409 record change 1/2 to 'a'? [Ynesfdaq?]
408 410 @@ -2,2 +3,3 @@
409 411 do not process $Id:
410 412 xxx $
411 413 +bar
412 414 record change 2/2 to 'a'? [Ynesfdaq?]
413 415
414 416 File a should be clean
415 417
416 418 $ hg status -A a
417 419 C a
418 420
419 421 rollback and revert expansion
420 422
421 423 $ cat a
422 424 expand $Id: a,v 78e0a02d76aa 1970/01/01 00:00:11 test $
423 425 foo
424 426 do not process $Id:
425 427 xxx $
426 428 bar
427 429 $ hg --verbose rollback
428 430 repository tip rolled back to revision 2 (undo commit)
429 431 working directory now based on revision 2
430 432 overwriting a expanding keywords
431 433 $ hg status a
432 434 M a
433 435 $ cat a
434 436 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
435 437 foo
436 438 do not process $Id:
437 439 xxx $
438 440 bar
439 441 $ echo '$Id$' > y
440 442 $ echo '$Id$' > z
441 443 $ hg add y
442 444 $ hg commit -Am "rollback only" z
443 445 $ cat z
444 446 $Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
445 447 $ hg --verbose rollback
446 448 repository tip rolled back to revision 2 (undo commit)
447 449 working directory now based on revision 2
448 450 overwriting z shrinking keywords
449 451
450 452 Only z should be overwritten
451 453
452 454 $ hg status a y z
453 455 M a
454 456 A y
455 457 A z
456 458 $ cat z
457 459 $Id$
458 460 $ hg forget y z
459 461 $ rm y z
460 462
461 463 record added file alone
462 464
463 465 $ hg -v record -l msg -d '12 2' r<<EOF
464 466 > y
465 467 > EOF
466 468 diff --git a/r b/r
467 469 new file mode 100644
468 470 examine changes to 'r'? [Ynesfdaq?]
469 471 r
470 472 committed changeset 3:82a2f715724d
471 473 overwriting r expanding keywords
472 474 - status call required for dirstate.normallookup() check
473 475 $ hg status r
474 476 $ hg --verbose rollback
475 477 repository tip rolled back to revision 2 (undo commit)
476 478 working directory now based on revision 2
477 479 overwriting r shrinking keywords
478 480 $ hg forget r
479 481 $ rm msg r
480 482 $ hg update -C
481 483 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
482 484
483 485 record added keyword ignored file
484 486
485 487 $ echo '$Id$' > i
486 488 $ hg add i
487 489 $ hg --verbose record -d '13 1' -m recignored<<EOF
488 490 > y
489 491 > EOF
490 492 diff --git a/i b/i
491 493 new file mode 100644
492 494 examine changes to 'i'? [Ynesfdaq?]
493 495 i
494 496 committed changeset 3:9f40ceb5a072
495 497 $ cat i
496 498 $Id$
497 499 $ hg -q rollback
498 500 $ hg forget i
499 501 $ rm i
500 502
501 503 amend
502 504
503 505 $ echo amend >> a
504 506 $ echo amend >> b
505 507 $ hg -q commit -d '14 1' -m 'prepare amend'
506 508
507 509 $ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords
508 510 overwriting a expanding keywords
509 511 $ hg -q id
510 512 577e60613a88
511 513 $ head -1 a
512 514 expand $Id: a,v 577e60613a88 1970/01/01 00:00:15 test $
513 515
514 516 $ hg -q strip -n tip
515 517
516 518 Test patch queue repo
517 519
518 520 $ hg init --mq
519 521 $ hg qimport -r tip -n mqtest.diff
520 522 $ hg commit --mq -m mqtest
521 523
522 524 Keywords should not be expanded in patch
523 525
524 526 $ cat .hg/patches/mqtest.diff
525 527 # HG changeset patch
526 528 # User User Name <user@example.com>
527 529 # Date 1 0
528 530 # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
529 531 # Parent ef63ca68695bc9495032c6fda1350c71e6d256e9
530 532 cndiff
531 533
532 534 diff -r ef63ca68695b -r 40a904bbbe4c c
533 535 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
534 536 +++ b/c Thu Jan 01 00:00:01 1970 +0000
535 537 @@ -0,0 +1,2 @@
536 538 +$Id$
537 539 +tests for different changenodes
538 540
539 541 $ hg qpop
540 542 popping mqtest.diff
541 543 patch queue now empty
542 544
543 545 qgoto, implying qpush, should expand
544 546
545 547 $ hg qgoto mqtest.diff
546 548 applying mqtest.diff
547 549 now at: mqtest.diff
548 550 $ cat c
549 551 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
550 552 tests for different changenodes
551 553 $ hg cat c
552 554 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
553 555 tests for different changenodes
554 556
555 557 Keywords should not be expanded in filelog
556 558
557 559 $ hg --config 'extensions.keyword=!' cat c
558 560 $Id$
559 561 tests for different changenodes
560 562
561 563 qpop and move on
562 564
563 565 $ hg qpop
564 566 popping mqtest.diff
565 567 patch queue now empty
566 568
567 569 Copy and show added kwfiles
568 570
569 571 $ hg cp a c
570 572 $ hg kwfiles
571 573 a
572 574 c
573 575
574 576 Commit and show expansion in original and copy
575 577
576 578 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
577 579 c
578 580 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
579 581 removing unknown node 40a904bbbe4c from 1-phase boundary
580 582 overwriting c expanding keywords
581 583 committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
582 584 $ cat a c
583 585 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
584 586 do not process $Id:
585 587 xxx $
586 588 expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
587 589 do not process $Id:
588 590 xxx $
589 591
590 592 Touch copied c and check its status
591 593
592 594 $ touch c
593 595 $ hg status
594 596
595 597 Copy kwfile to keyword ignored file unexpanding keywords
596 598
597 599 $ hg --verbose copy a i
598 600 copying a to i
599 601 overwriting i shrinking keywords
600 602 $ head -n 1 i
601 603 expand $Id$
602 604 $ hg forget i
603 605 $ rm i
604 606
605 607 Copy ignored file to ignored file: no overwriting
606 608
607 609 $ hg --verbose copy b i
608 610 copying b to i
609 611 $ hg forget i
610 612 $ rm i
611 613
612 614 cp symlink file; hg cp -A symlink file (part1)
613 615 - copied symlink points to kwfile: overwrite
614 616
617 #if symlink
615 618 $ cp sym i
616 619 $ ls -l i
617 620 -rw-r--r--* (glob)
618 621 $ head -1 i
619 622 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
620 623 $ hg copy --after --verbose sym i
621 624 copying sym to i
622 625 overwriting i shrinking keywords
623 626 $ head -1 i
624 627 expand $Id$
625 628 $ hg forget i
626 629 $ rm i
630 #endif
627 631
628 632 Test different options of hg kwfiles
629 633
630 634 $ hg kwfiles
631 635 a
632 636 c
633 637 $ hg -v kwfiles --ignore
634 638 I b
635 639 I sym
636 640 $ hg kwfiles --all
637 641 K a
638 642 K c
639 643 I b
640 644 I sym
641 645
642 646 Diff specific revision
643 647
644 648 $ hg diff --rev 1
645 649 diff -r ef63ca68695b c
646 650 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
647 651 +++ b/c * (glob)
648 652 @@ -0,0 +1,3 @@
649 653 +expand $Id$
650 654 +do not process $Id:
651 655 +xxx $
652 656
653 657 Status after rollback:
654 658
655 659 $ hg rollback
656 660 repository tip rolled back to revision 1 (undo commit)
657 661 working directory now based on revision 1
658 662 $ hg status
659 663 A c
660 664 $ hg update --clean
661 665 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
662 666
663 667 #if symlink
664 668
665 669 cp symlink file; hg cp -A symlink file (part2)
666 670 - copied symlink points to kw ignored file: do not overwrite
667 671
668 672 $ cat a > i
669 673 $ ln -s i symignored
670 674 $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
671 675 $ cp symignored x
672 676 $ hg copy --after --verbose symignored x
673 677 copying symignored to x
674 678 $ head -n 1 x
675 679 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
676 680 $ hg forget x
677 681 $ rm x
678 682
679 683 $ hg rollback
680 684 repository tip rolled back to revision 1 (undo commit)
681 685 working directory now based on revision 1
682 686 $ hg update --clean
683 687 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
684 688 $ rm i symignored
685 689
686 690 #endif
687 691
688 692 Custom keywordmaps as argument to kwdemo
689 693
690 694 $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
691 695 [extensions]
692 696 keyword =
693 697 [keyword]
694 698 ** =
695 699 b = ignore
696 700 demo.txt =
697 701 i = ignore
698 702 [keywordset]
699 703 svn = False
700 704 [keywordmaps]
701 705 Xinfo = {author}: {desc}
702 706 $Xinfo: test: hg keyword configuration and expansion example $
703 707
704 708 Configure custom keywordmaps
705 709
706 710 $ cat <<EOF >>$HGRCPATH
707 711 > [keywordmaps]
708 712 > Id = {file} {node|short} {date|rfc822date} {author|user}
709 713 > Xinfo = {author}: {desc}
710 714 > EOF
711 715
712 716 Cat and hg cat files before custom expansion
713 717
714 718 $ cat a b
715 719 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
716 720 do not process $Id:
717 721 xxx $
718 722 ignore $Id$
719 723 $ hg cat sym a b && echo
720 724 expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
721 725 do not process $Id:
722 726 xxx $
723 727 ignore $Id$
724 728 a
725 729
726 730 Write custom keyword and prepare multiline commit message
727 731
728 732 $ echo '$Xinfo$' >> a
729 733 $ cat <<EOF >> log
730 734 > firstline
731 735 > secondline
732 736 > EOF
733 737
734 738 Interrupted commit should not change state
735 739
736 740 $ hg commit
737 741 abort: empty commit message
738 742 [255]
739 743 $ hg status
740 744 M a
741 745 ? c
742 746 ? log
743 747
744 748 Commit with multiline message and custom expansion
745 749
746 750 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
747 751 a
748 752 removing unknown node 40a904bbbe4c from 1-phase boundary
749 753 overwriting a expanding keywords
750 754 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
751 755 $ rm log
752 756
753 757 Stat, verify and show custom expansion (firstline)
754 758
755 759 $ hg status
756 760 ? c
757 761 $ hg verify
758 762 checking changesets
759 763 checking manifests
760 764 crosschecking files in changesets and manifests
761 765 checking files
762 766 3 files, 3 changesets, 4 total revisions
763 767 $ cat a b
764 768 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
765 769 do not process $Id:
766 770 xxx $
767 771 $Xinfo: User Name <user@example.com>: firstline $
768 772 ignore $Id$
769 773 $ hg cat sym a b && echo
770 774 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
771 775 do not process $Id:
772 776 xxx $
773 777 $Xinfo: User Name <user@example.com>: firstline $
774 778 ignore $Id$
775 779 a
776 780
777 781 annotate
778 782
779 783 $ hg annotate a
780 784 1: expand $Id$
781 785 1: do not process $Id:
782 786 1: xxx $
783 787 2: $Xinfo$
784 788
785 789 remove with status checks
786 790
787 791 $ hg debugrebuildstate
788 792 $ hg remove a
789 793 $ hg --debug commit -m rma
790 794 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
791 795 $ hg status
792 796 ? c
793 797
794 798 Rollback, revert, and check expansion
795 799
796 800 $ hg rollback
797 801 repository tip rolled back to revision 2 (undo commit)
798 802 working directory now based on revision 2
799 803 $ hg status
800 804 R a
801 805 ? c
802 806 $ hg revert --no-backup --rev tip a
803 807 $ cat a
804 808 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
805 809 do not process $Id:
806 810 xxx $
807 811 $Xinfo: User Name <user@example.com>: firstline $
808 812
809 813 Clone to test global and local configurations
810 814
811 815 $ cd ..
812 816
813 817 Expansion in destinaton with global configuration
814 818
815 819 $ hg --quiet clone Test globalconf
816 820 $ cat globalconf/a
817 821 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
818 822 do not process $Id:
819 823 xxx $
820 824 $Xinfo: User Name <user@example.com>: firstline $
821 825
822 826 No expansion in destination with local configuration in origin only
823 827
824 828 $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
825 829 $ cat localconf/a
826 830 expand $Id$
827 831 do not process $Id:
828 832 xxx $
829 833 $Xinfo$
830 834
831 835 Clone to test incoming
832 836
833 837 $ hg clone -r1 Test Test-a
834 838 adding changesets
835 839 adding manifests
836 840 adding file changes
837 841 added 2 changesets with 3 changes to 3 files
838 842 updating to branch default
839 843 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
840 844 $ cd Test-a
841 845 $ cat <<EOF >> .hg/hgrc
842 846 > [paths]
843 847 > default = ../Test
844 848 > EOF
845 849 $ hg incoming
846 850 comparing with $TESTTMP/Test (glob)
847 851 searching for changes
848 852 changeset: 2:bb948857c743
849 853 tag: tip
850 854 user: User Name <user@example.com>
851 855 date: Thu Jan 01 00:00:02 1970 +0000
852 856 summary: firstline
853 857
854 858 Imported patch should not be rejected
855 859
856 860 >>> import re
857 861 >>> text = re.sub(r'(Id.*)', r'\1 rejecttest', open('a').read())
858 862 >>> open('a', 'wb').write(text)
859 863 $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
860 864 a
861 865 overwriting a expanding keywords
862 866 committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
863 867 $ hg export -o ../rejecttest.diff tip
864 868 $ cd ../Test
865 869 $ hg import ../rejecttest.diff
866 870 applying ../rejecttest.diff
867 871 $ cat a b
868 872 expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
869 873 do not process $Id: rejecttest
870 874 xxx $
871 875 $Xinfo: User Name <user@example.com>: rejects? $
872 876 ignore $Id$
873 877
874 878 $ hg rollback
875 879 repository tip rolled back to revision 2 (undo import)
876 880 working directory now based on revision 2
877 881 $ hg update --clean
878 882 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
879 883
880 884 kwexpand/kwshrink on selected files
881 885
882 886 $ mkdir x
883 887 $ hg copy a x/a
884 888 $ hg --verbose kwshrink a
885 889 overwriting a shrinking keywords
886 890 - sleep required for dirstate.normal() check
887 891 $ sleep 1
888 892 $ hg status a
889 893 $ hg --verbose kwexpand a
890 894 overwriting a expanding keywords
891 895 $ hg status a
892 896
893 897 kwexpand x/a should abort
894 898
895 899 $ hg --verbose kwexpand x/a
896 900 abort: outstanding uncommitted changes
897 901 [255]
898 902 $ cd x
899 903 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
900 904 x/a
901 905 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
902 906 overwriting x/a expanding keywords
903 907 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
904 908 $ cat a
905 909 expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
906 910 do not process $Id:
907 911 xxx $
908 912 $Xinfo: User Name <user@example.com>: xa $
909 913
910 914 kwshrink a inside directory x
911 915
912 916 $ hg --verbose kwshrink a
913 917 overwriting x/a shrinking keywords
914 918 $ cat a
915 919 expand $Id$
916 920 do not process $Id:
917 921 xxx $
918 922 $Xinfo$
919 923 $ cd ..
920 924
921 925 kwexpand nonexistent
922 926
923 927 $ hg kwexpand nonexistent
924 928 nonexistent:* (glob)
925 929
926 930
931 #if serve
927 932 hg serve
928 933 - expand with hgweb file
929 934 - no expansion with hgweb annotate/changeset/filediff
930 935 - check errors
931 936
932 937 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
933 938 $ cat hg.pid >> $DAEMON_PIDS
934 939 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'file/tip/a/?style=raw'
935 940 200 Script output follows
936 941
937 942 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
938 943 do not process $Id:
939 944 xxx $
940 945 $Xinfo: User Name <user@example.com>: firstline $
941 946 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'annotate/tip/a/?style=raw'
942 947 200 Script output follows
943 948
944 949
945 950 user@1: expand $Id$
946 951 user@1: do not process $Id:
947 952 user@1: xxx $
948 953 user@2: $Xinfo$
949 954
950 955
951 956
952 957
953 958 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'rev/tip/?style=raw'
954 959 200 Script output follows
955 960
956 961
957 962 # HG changeset patch
958 963 # User User Name <user@example.com>
959 964 # Date 3 0
960 965 # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
961 966 # Parent bb948857c743469b22bbf51f7ec8112279ca5d83
962 967 xa
963 968
964 969 diff -r bb948857c743 -r b4560182a3f9 x/a
965 970 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
966 971 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000
967 972 @@ -0,0 +1,4 @@
968 973 +expand $Id$
969 974 +do not process $Id:
970 975 +xxx $
971 976 +$Xinfo$
972 977
973 978 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'diff/bb948857c743/a?style=raw'
974 979 200 Script output follows
975 980
976 981
977 982 diff -r ef63ca68695b -r bb948857c743 a
978 983 --- a/a Thu Jan 01 00:00:00 1970 +0000
979 984 +++ b/a Thu Jan 01 00:00:02 1970 +0000
980 985 @@ -1,3 +1,4 @@
981 986 expand $Id$
982 987 do not process $Id:
983 988 xxx $
984 989 +$Xinfo$
985 990
986 991
987 992
988 993
989 994 $ cat errors.log
995 #endif
990 996
991 997 Prepare merge and resolve tests
992 998
993 999 $ echo '$Id$' > m
994 1000 $ hg add m
995 1001 $ hg commit -m 4kw
996 1002 $ echo foo >> m
997 1003 $ hg commit -m 5foo
998 1004
999 1005 simplemerge
1000 1006
1001 1007 $ hg update 4
1002 1008 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1003 1009 $ echo foo >> m
1004 1010 $ hg commit -m 6foo
1005 1011 created new head
1006 1012 $ hg merge
1007 1013 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1008 1014 (branch merge, don't forget to commit)
1009 1015 $ hg commit -m simplemerge
1010 1016 $ cat m
1011 1017 $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
1012 1018 foo
1013 1019
1014 1020 conflict: keyword should stay outside conflict zone
1015 1021
1016 1022 $ hg update 4
1017 1023 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1018 1024 $ echo bar >> m
1019 1025 $ hg commit -m 8bar
1020 1026 created new head
1021 1027 $ hg merge
1022 1028 merging m
1023 1029 warning: conflicts during merge.
1024 1030 merging m incomplete! (edit conflicts, then use 'hg resolve --mark')
1025 1031 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1026 1032 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1027 1033 [1]
1028 1034 $ cat m
1029 1035 $Id$
1030 1036 <<<<<<< local
1031 1037 bar
1032 1038 =======
1033 1039 foo
1034 1040 >>>>>>> other
1035 1041
1036 1042 resolve to local
1037 1043
1038 1044 $ HGMERGE=internal:local hg resolve -a
1039 1045 $ hg commit -m localresolve
1040 1046 $ cat m
1041 1047 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1042 1048 bar
1043 1049
1044 1050 Test restricted mode with transplant -b
1045 1051
1046 1052 $ hg update 6
1047 1053 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1048 1054 $ hg branch foo
1049 1055 marked working directory as branch foo
1050 1056 (branches are permanent and global, did you want a bookmark?)
1051 1057 $ mv a a.bak
1052 1058 $ echo foobranch > a
1053 1059 $ cat a.bak >> a
1054 1060 $ rm a.bak
1055 1061 $ hg commit -m 9foobranch
1056 1062 $ hg update default
1057 1063 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1058 1064 $ hg -y transplant -b foo tip
1059 1065 applying 4aa30d025d50
1060 1066 4aa30d025d50 transplanted to e00abbf63521
1061 1067
1062 1068 Expansion in changeset but not in file
1063 1069
1064 1070 $ hg tip -p
1065 1071 changeset: 11:e00abbf63521
1066 1072 tag: tip
1067 1073 parent: 9:800511b3a22d
1068 1074 user: test
1069 1075 date: Thu Jan 01 00:00:00 1970 +0000
1070 1076 summary: 9foobranch
1071 1077
1072 1078 diff -r 800511b3a22d -r e00abbf63521 a
1073 1079 --- a/a Thu Jan 01 00:00:00 1970 +0000
1074 1080 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1075 1081 @@ -1,3 +1,4 @@
1076 1082 +foobranch
1077 1083 expand $Id$
1078 1084 do not process $Id:
1079 1085 xxx $
1080 1086
1081 1087 $ head -n 2 a
1082 1088 foobranch
1083 1089 expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1084 1090
1085 1091 Turn off expansion
1086 1092
1087 1093 $ hg -q rollback
1088 1094 $ hg -q update -C
1089 1095
1090 1096 kwshrink with unknown file u
1091 1097
1092 1098 $ cp a u
1093 1099 $ hg --verbose kwshrink
1094 1100 overwriting a shrinking keywords
1095 1101 overwriting m shrinking keywords
1096 1102 overwriting x/a shrinking keywords
1097 1103
1098 1104 Keywords shrunk in working directory, but not yet disabled
1099 1105 - cat shows unexpanded keywords
1100 1106 - hg cat shows expanded keywords
1101 1107
1102 1108 $ cat a b
1103 1109 expand $Id$
1104 1110 do not process $Id:
1105 1111 xxx $
1106 1112 $Xinfo$
1107 1113 ignore $Id$
1108 1114 $ hg cat sym a b && echo
1109 1115 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1110 1116 do not process $Id:
1111 1117 xxx $
1112 1118 $Xinfo: User Name <user@example.com>: firstline $
1113 1119 ignore $Id$
1114 1120 a
1115 1121
1116 1122 Now disable keyword expansion
1117 1123
1118 1124 $ rm "$HGRCPATH"
1119 1125 $ cat a b
1120 1126 expand $Id$
1121 1127 do not process $Id:
1122 1128 xxx $
1123 1129 $Xinfo$
1124 1130 ignore $Id$
1125 1131 $ hg cat sym a b && echo
1126 1132 expand $Id$
1127 1133 do not process $Id:
1128 1134 xxx $
1129 1135 $Xinfo$
1130 1136 ignore $Id$
1131 1137 a
1132 1138
1133 1139 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now