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