##// END OF EJS Templates
tests: update test-keyword to pass our import checker
Augie Fackler -
r33963:237d2502 default
parent child Browse files
Show More
@@ -1,1475 +1,1475
1 1 Run kwdemo outside a repo
2 2 $ hg -q --config extensions.keyword= --config keywordmaps.Foo="{author|user}" kwdemo
3 3 [extensions]
4 4 keyword =
5 5 [keyword]
6 6 demo.txt =
7 7 [keywordset]
8 8 svn = False
9 9 [keywordmaps]
10 10 Foo = {author|user}
11 11 $Foo: test $
12 12
13 13 $ cat <<EOF >> $HGRCPATH
14 14 > [extensions]
15 15 > keyword =
16 16 > mq =
17 17 > notify =
18 18 > record =
19 19 > transplant =
20 20 > [ui]
21 21 > interactive = true
22 22 > EOF
23 23
24 24 hide outer repo
25 25 $ hg init
26 26
27 27 Run kwdemo before [keyword] files are set up
28 28 as it would succeed without uisetup otherwise
29 29
30 30 $ hg --quiet kwdemo
31 31 [extensions]
32 32 keyword =
33 33 [keyword]
34 34 demo.txt =
35 35 [keywordset]
36 36 svn = False
37 37 [keywordmaps]
38 38 Author = {author|user}
39 39 Date = {date|utcdate}
40 40 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
41 41 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
42 42 RCSFile = {file|basename},v
43 43 RCSfile = {file|basename},v
44 44 Revision = {node|short}
45 45 Source = {root}/{file},v
46 46 $Author: test $
47 47 $Date: ????/??/?? ??:??:?? $ (glob)
48 48 $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
49 49 $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
50 50 $RCSFile: demo.txt,v $
51 51 $RCSfile: demo.txt,v $
52 52 $Revision: ???????????? $ (glob)
53 53 $Source: */demo.txt,v $ (glob)
54 54
55 55 $ hg --quiet kwdemo "Branch = {branches}"
56 56 [extensions]
57 57 keyword =
58 58 [keyword]
59 59 demo.txt =
60 60 [keywordset]
61 61 svn = False
62 62 [keywordmaps]
63 63 Branch = {branches}
64 64 $Branch: demobranch $
65 65
66 66 (test template filter svnisodate and svnutcdate)
67 67
68 68 $ hg --quiet kwdemo --config keywordset.svn=True
69 69 [extensions]
70 70 keyword =
71 71 [keyword]
72 72 demo.txt =
73 73 [keywordset]
74 74 svn = True
75 75 [keywordmaps]
76 76 Author = {author|user}
77 77 Date = {date|svnisodate}
78 78 Id = {file|basename},v {node|short} {date|svnutcdate} {author|user}
79 79 LastChangedBy = {author|user}
80 80 LastChangedDate = {date|svnisodate}
81 81 LastChangedRevision = {node|short}
82 82 Revision = {node|short}
83 83 $Author: test $
84 84 $Date: ????-??-?? ??:??:?? ????? (???, ?? ??? ????) $ (glob)
85 85 $Id: demo.txt,v ???????????? ????-??-?? ??:??:??Z test $ (glob)
86 86 $LastChangedBy: test $
87 87 $LastChangedDate: ????-??-?? ??:??:?? ????? (???, ?? ??? ????) $ (glob)
88 88 $LastChangedRevision: ???????????? $ (glob)
89 89 $Revision: ???????????? $ (glob)
90 90
91 91 $ cat <<EOF >> $HGRCPATH
92 92 > [keyword]
93 93 > ** =
94 94 > b = ignore
95 95 > i = ignore
96 96 > [hooks]
97 97 > EOF
98 98 $ cp $HGRCPATH $HGRCPATH.nohooks
99 99 > cat <<EOF >> $HGRCPATH
100 100 > commit=
101 101 > commit.test=cp a hooktest
102 102 > EOF
103 103
104 104 $ hg init Test-bndl
105 105 $ cd Test-bndl
106 106
107 107 kwshrink should exit silently in empty/invalid repo
108 108
109 109 $ hg kwshrink
110 110
111 111 Symlinks cannot be created on Windows.
112 112 A bundle to test this was made with:
113 113 hg init t
114 114 cd t
115 115 echo a > a
116 116 ln -s a sym
117 117 hg add sym
118 118 hg ci -m addsym -u mercurial
119 119 hg bundle --base null ../test-keyword.hg
120 120
121 121 $ hg pull -u "$TESTDIR"/bundles/test-keyword.hg
122 122 pulling from *test-keyword.hg (glob)
123 123 requesting all changes
124 124 adding changesets
125 125 adding manifests
126 126 adding file changes
127 127 added 1 changesets with 1 changes to 1 files
128 128 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 129
130 130 $ echo 'expand $Id$' > a
131 131 $ echo 'do not process $Id:' >> a
132 132 $ echo 'xxx $' >> a
133 133 $ echo 'ignore $Id$' > b
134 134
135 135 Output files as they were created
136 136
137 137 $ cat a b
138 138 expand $Id$
139 139 do not process $Id:
140 140 xxx $
141 141 ignore $Id$
142 142
143 143 no kwfiles
144 144
145 145 $ hg kwfiles
146 146
147 147 untracked candidates
148 148
149 149 $ hg -v kwfiles --unknown
150 150 k a
151 151
152 152 Add files and check status
153 153
154 154 $ hg addremove
155 155 adding a
156 156 adding b
157 157 $ hg status
158 158 A a
159 159 A b
160 160
161 161
162 162 Default keyword expansion including commit hook
163 163 Interrupted commit should not change state or run commit hook
164 164
165 165 $ hg --debug commit
166 166 abort: empty commit message
167 167 [255]
168 168 $ hg status
169 169 A a
170 170 A b
171 171
172 172 Commit with several checks
173 173
174 174 $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
175 175 committing files:
176 176 a
177 177 b
178 178 committing manifest
179 179 committing changelog
180 180 overwriting a expanding keywords
181 181 updating the branch cache
182 182 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
183 183 running hook commit.test: cp a hooktest
184 184 $ hg status
185 185 ? hooktest
186 186 $ hg debugrebuildstate
187 187 $ hg --quiet identify
188 188 ef63ca68695b
189 189
190 190 cat files in working directory with keywords expanded
191 191
192 192 $ cat a b
193 193 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
194 194 do not process $Id:
195 195 xxx $
196 196 ignore $Id$
197 197
198 198 hg cat files and symlink, no expansion
199 199
200 200 $ hg cat sym a b && echo
201 201 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
202 202 do not process $Id:
203 203 xxx $
204 204 ignore $Id$
205 205 a
206 206
207 207 $ diff a hooktest
208 208
209 209 $ cp $HGRCPATH.nohooks $HGRCPATH
210 210 $ rm hooktest
211 211
212 212 hg status of kw-ignored binary file starting with '\1\n'
213 213
214 214 >>> open("i", "wb").write("\1\nfoo")
215 215 $ hg -q commit -Am metasep i
216 216 $ hg status
217 217 >>> open("i", "wb").write("\1\nbar")
218 218 $ hg status
219 219 M i
220 220 $ hg -q commit -m "modify metasep" i
221 221 $ hg status --rev 2:3
222 222 M i
223 223 $ touch empty
224 224 $ hg -q commit -A -m "another file"
225 225 $ hg status -A --rev 3:4 i
226 226 C i
227 227
228 228 $ hg -q strip --no-backup 2
229 229
230 230 Test hook execution
231 231
232 232 bundle
233 233
234 234 $ hg bundle --base null ../kw.hg
235 235 2 changesets found
236 236 $ cd ..
237 237 $ hg init Test
238 238 $ cd Test
239 239
240 240 Notify on pull to check whether keywords stay as is in email
241 241 ie. if patch.diff wrapper acts as it should
242 242
243 243 $ cat <<EOF >> $HGRCPATH
244 244 > [hooks]
245 245 > incoming.notify = python:hgext.notify.hook
246 246 > [notify]
247 247 > sources = pull
248 248 > diffstat = False
249 249 > maxsubject = 15
250 250 > [reposubs]
251 251 > * = Test
252 252 > EOF
253 253
254 254 Pull from bundle and trigger notify
255 255
256 256 $ hg pull -u ../kw.hg
257 257 pulling from ../kw.hg
258 258 requesting all changes
259 259 adding changesets
260 260 adding manifests
261 261 adding file changes
262 262 added 2 changesets with 3 changes to 3 files
263 263 Content-Type: text/plain; charset="us-ascii"
264 264 MIME-Version: 1.0
265 265 Content-Transfer-Encoding: 7bit
266 266 Date: * (glob)
267 267 Subject: changeset in...
268 268 From: mercurial
269 269 X-Hg-Notification: changeset a2392c293916
270 270 Message-Id: <hg.a2392c293916*> (glob)
271 271 To: Test
272 272
273 273 changeset a2392c293916 in $TESTTMP/Test (glob)
274 274 details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
275 275 description:
276 276 addsym
277 277
278 278 diffs (6 lines):
279 279
280 280 diff -r 000000000000 -r a2392c293916 sym
281 281 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
282 282 +++ b/sym Sat Feb 09 20:25:47 2008 +0100
283 283 @@ -0,0 +1,1 @@
284 284 +a
285 285 \ No newline at end of file
286 286 Content-Type: text/plain; charset="us-ascii"
287 287 MIME-Version: 1.0
288 288 Content-Transfer-Encoding: 7bit
289 289 Date:* (glob)
290 290 Subject: changeset in...
291 291 From: User Name <user@example.com>
292 292 X-Hg-Notification: changeset ef63ca68695b
293 293 Message-Id: <hg.ef63ca68695b*> (glob)
294 294 To: Test
295 295
296 296 changeset ef63ca68695b in $TESTTMP/Test (glob)
297 297 details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
298 298 description:
299 299 absym
300 300
301 301 diffs (12 lines):
302 302
303 303 diff -r a2392c293916 -r ef63ca68695b a
304 304 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
305 305 +++ b/a Thu Jan 01 00:00:00 1970 +0000
306 306 @@ -0,0 +1,3 @@
307 307 +expand $Id$
308 308 +do not process $Id:
309 309 +xxx $
310 310 diff -r a2392c293916 -r ef63ca68695b b
311 311 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
312 312 +++ b/b Thu Jan 01 00:00:00 1970 +0000
313 313 @@ -0,0 +1,1 @@
314 314 +ignore $Id$
315 315 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 316
317 317 $ cp $HGRCPATH.nohooks $HGRCPATH
318 318
319 319 Touch files and check with status
320 320
321 321 $ touch a b
322 322 $ hg status
323 323
324 324 Update and expand
325 325
326 326 $ rm sym a b
327 327 $ hg update -C
328 328 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
329 329 $ cat a b
330 330 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
331 331 do not process $Id:
332 332 xxx $
333 333 ignore $Id$
334 334
335 335 Check whether expansion is filewise and file mode is preserved
336 336
337 337 $ echo '$Id$' > c
338 338 $ echo 'tests for different changenodes' >> c
339 339 #if unix-permissions
340 340 $ chmod 600 c
341 341 $ ls -l c | cut -b 1-10
342 342 -rw-------
343 343 #endif
344 344
345 345 commit file c
346 346
347 347 $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
348 348 adding c
349 349 #if unix-permissions
350 350 $ ls -l c | cut -b 1-10
351 351 -rw-------
352 352 #endif
353 353
354 354 force expansion
355 355
356 356 $ hg -v kwexpand
357 357 overwriting a expanding keywords
358 358 overwriting c expanding keywords
359 359
360 360 compare changenodes in a and c
361 361
362 362 $ cat a c
363 363 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
364 364 do not process $Id:
365 365 xxx $
366 366 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
367 367 tests for different changenodes
368 368
369 369 record
370 370
371 371 $ echo '$Id$' > r
372 372 $ hg add r
373 373
374 374 record chunk
375 375
376 376 >>> lines = open('a', 'rb').readlines()
377 377 >>> lines.insert(1, 'foo\n')
378 378 >>> lines.append('bar\n')
379 379 >>> open('a', 'wb').writelines(lines)
380 380 $ hg record -d '10 1' -m rectest a<<EOF
381 381 > y
382 382 > y
383 383 > n
384 384 > EOF
385 385 diff --git a/a b/a
386 386 2 hunks, 2 lines changed
387 387 examine changes to 'a'? [Ynesfdaq?] y
388 388
389 389 @@ -1,3 +1,4 @@
390 390 expand $Id$
391 391 +foo
392 392 do not process $Id:
393 393 xxx $
394 394 record change 1/2 to 'a'? [Ynesfdaq?] y
395 395
396 396 @@ -2,2 +3,3 @@
397 397 do not process $Id:
398 398 xxx $
399 399 +bar
400 400 record change 2/2 to 'a'? [Ynesfdaq?] n
401 401
402 402
403 403 $ hg identify
404 404 5f5eb23505c3+ tip
405 405 $ hg status
406 406 M a
407 407 A r
408 408
409 409 Cat modified file a
410 410
411 411 $ cat a
412 412 expand $Id: a,v 5f5eb23505c3 1970/01/01 00:00:10 test $
413 413 foo
414 414 do not process $Id:
415 415 xxx $
416 416 bar
417 417
418 418 Diff remaining chunk
419 419
420 420 $ hg diff a
421 421 diff -r 5f5eb23505c3 a
422 422 --- a/a Thu Jan 01 00:00:09 1970 -0000
423 423 +++ b/a * (glob)
424 424 @@ -2,3 +2,4 @@
425 425 foo
426 426 do not process $Id:
427 427 xxx $
428 428 +bar
429 429
430 430 $ hg rollback
431 431 repository tip rolled back to revision 2 (undo commit)
432 432 working directory now based on revision 2
433 433
434 434 Record all chunks in file a
435 435
436 436 $ echo foo > msg
437 437
438 438 - do not use "hg record -m" here!
439 439
440 440 $ hg record -l msg -d '11 1' a<<EOF
441 441 > y
442 442 > y
443 443 > y
444 444 > EOF
445 445 diff --git a/a b/a
446 446 2 hunks, 2 lines changed
447 447 examine changes to 'a'? [Ynesfdaq?] y
448 448
449 449 @@ -1,3 +1,4 @@
450 450 expand $Id$
451 451 +foo
452 452 do not process $Id:
453 453 xxx $
454 454 record change 1/2 to 'a'? [Ynesfdaq?] y
455 455
456 456 @@ -2,2 +3,3 @@
457 457 do not process $Id:
458 458 xxx $
459 459 +bar
460 460 record change 2/2 to 'a'? [Ynesfdaq?] y
461 461
462 462
463 463 File a should be clean
464 464
465 465 $ hg status -A a
466 466 C a
467 467
468 468 rollback and revert expansion
469 469
470 470 $ cat a
471 471 expand $Id: a,v 78e0a02d76aa 1970/01/01 00:00:11 test $
472 472 foo
473 473 do not process $Id:
474 474 xxx $
475 475 bar
476 476 $ hg --verbose rollback
477 477 repository tip rolled back to revision 2 (undo commit)
478 478 working directory now based on revision 2
479 479 overwriting a expanding keywords
480 480 $ hg status a
481 481 M a
482 482 $ cat a
483 483 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
484 484 foo
485 485 do not process $Id:
486 486 xxx $
487 487 bar
488 488 $ echo '$Id$' > y
489 489 $ echo '$Id$' > z
490 490 $ hg add y
491 491 $ hg commit -Am "rollback only" z
492 492 $ cat z
493 493 $Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
494 494 $ hg --verbose rollback
495 495 repository tip rolled back to revision 2 (undo commit)
496 496 working directory now based on revision 2
497 497 overwriting z shrinking keywords
498 498
499 499 Only z should be overwritten
500 500
501 501 $ hg status a y z
502 502 M a
503 503 A y
504 504 A z
505 505 $ cat z
506 506 $Id$
507 507 $ hg forget y z
508 508 $ rm y z
509 509
510 510 record added file alone
511 511
512 512 $ hg -v record -l msg -d '12 2' r<<EOF
513 513 > y
514 514 > y
515 515 > EOF
516 516 diff --git a/r b/r
517 517 new file mode 100644
518 518 examine changes to 'r'? [Ynesfdaq?] y
519 519
520 520 @@ -0,0 +1,1 @@
521 521 +$Id$
522 522 record this change to 'r'? [Ynesfdaq?] y
523 523
524 524 resolving manifests
525 525 patching file r
526 526 committing files:
527 527 r
528 528 committing manifest
529 529 committing changelog
530 530 committed changeset 3:82a2f715724d
531 531 overwriting r expanding keywords
532 532 $ hg status r
533 533 $ hg --verbose rollback
534 534 repository tip rolled back to revision 2 (undo commit)
535 535 working directory now based on revision 2
536 536 overwriting r shrinking keywords
537 537 $ hg forget r
538 538 $ rm msg r
539 539 $ hg update -C
540 540 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
541 541
542 542 record added keyword ignored file
543 543
544 544 $ echo '$Id$' > i
545 545 $ hg add i
546 546 $ hg --verbose record -d '13 1' -m recignored<<EOF
547 547 > y
548 548 > y
549 549 > EOF
550 550 diff --git a/i b/i
551 551 new file mode 100644
552 552 examine changes to 'i'? [Ynesfdaq?] y
553 553
554 554 @@ -0,0 +1,1 @@
555 555 +$Id$
556 556 record this change to 'i'? [Ynesfdaq?] y
557 557
558 558 resolving manifests
559 559 patching file i
560 560 committing files:
561 561 i
562 562 committing manifest
563 563 committing changelog
564 564 committed changeset 3:9f40ceb5a072
565 565 $ cat i
566 566 $Id$
567 567 $ hg -q rollback
568 568 $ hg forget i
569 569 $ rm i
570 570
571 571 amend
572 572
573 573 $ echo amend >> a
574 574 $ echo amend >> b
575 575 $ hg -q commit -d '14 1' -m 'prepare amend'
576 576
577 577 $ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords
578 578 overwriting a expanding keywords
579 579 $ hg -q id
580 580 67d8c481a6be
581 581 $ head -1 a
582 582 expand $Id: a,v 67d8c481a6be 1970/01/01 00:00:15 test $
583 583
584 584 $ hg -q strip --no-backup tip
585 585
586 586 Test patch queue repo
587 587
588 588 $ hg init --mq
589 589 $ hg qimport -r tip -n mqtest.diff
590 590 $ hg commit --mq -m mqtest
591 591
592 592 Keywords should not be expanded in patch
593 593
594 594 $ cat .hg/patches/mqtest.diff
595 595 # HG changeset patch
596 596 # User User Name <user@example.com>
597 597 # Date 1 0
598 598 # Thu Jan 01 00:00:01 1970 +0000
599 599 # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
600 600 # Parent ef63ca68695bc9495032c6fda1350c71e6d256e9
601 601 cndiff
602 602
603 603 diff -r ef63ca68695b -r 40a904bbbe4c c
604 604 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
605 605 +++ b/c Thu Jan 01 00:00:01 1970 +0000
606 606 @@ -0,0 +1,2 @@
607 607 +$Id$
608 608 +tests for different changenodes
609 609
610 610 $ hg qpop
611 611 popping mqtest.diff
612 612 patch queue now empty
613 613
614 614 qgoto, implying qpush, should expand
615 615
616 616 $ hg qgoto mqtest.diff
617 617 applying mqtest.diff
618 618 now at: mqtest.diff
619 619 $ cat c
620 620 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
621 621 tests for different changenodes
622 622 $ hg cat c
623 623 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
624 624 tests for different changenodes
625 625
626 626 Keywords should not be expanded in filelog
627 627
628 628 $ hg --config 'extensions.keyword=!' cat c
629 629 $Id$
630 630 tests for different changenodes
631 631
632 632 qpop and move on
633 633
634 634 $ hg qpop
635 635 popping mqtest.diff
636 636 patch queue now empty
637 637
638 638 Copy and show added kwfiles
639 639
640 640 $ hg cp a c
641 641 $ hg kwfiles
642 642 a
643 643 c
644 644
645 645 Commit and show expansion in original and copy
646 646
647 647 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
648 648 committing files:
649 649 c
650 650 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
651 651 committing manifest
652 652 committing changelog
653 653 overwriting c expanding keywords
654 654 updating the branch cache
655 655 committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
656 656 $ cat a c
657 657 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
658 658 do not process $Id:
659 659 xxx $
660 660 expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
661 661 do not process $Id:
662 662 xxx $
663 663
664 664 Touch copied c and check its status
665 665
666 666 $ touch c
667 667 $ hg status
668 668
669 669 Copy kwfile to keyword ignored file unexpanding keywords
670 670
671 671 $ hg --verbose copy a i
672 672 copying a to i
673 673 overwriting i shrinking keywords
674 674 $ head -n 1 i
675 675 expand $Id$
676 676 $ hg forget i
677 677 $ rm i
678 678
679 679 Copy ignored file to ignored file: no overwriting
680 680
681 681 $ hg --verbose copy b i
682 682 copying b to i
683 683 $ hg forget i
684 684 $ rm i
685 685
686 686 cp symlink file; hg cp -A symlink file (part1)
687 687 - copied symlink points to kwfile: overwrite
688 688
689 689 #if symlink
690 690 $ cp sym i
691 691 $ ls -l i
692 692 -rw-r--r--* (glob)
693 693 $ head -1 i
694 694 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
695 695 $ hg copy --after --verbose sym i
696 696 copying sym to i
697 697 overwriting i shrinking keywords
698 698 $ head -1 i
699 699 expand $Id$
700 700 $ hg forget i
701 701 $ rm i
702 702 #endif
703 703
704 704 Test different options of hg kwfiles
705 705
706 706 $ hg kwfiles
707 707 a
708 708 c
709 709 $ hg -v kwfiles --ignore
710 710 I b
711 711 I sym
712 712 $ hg kwfiles --all
713 713 K a
714 714 K c
715 715 I b
716 716 I sym
717 717
718 718 Diff specific revision
719 719
720 720 $ hg diff --rev 1
721 721 diff -r ef63ca68695b c
722 722 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
723 723 +++ b/c * (glob)
724 724 @@ -0,0 +1,3 @@
725 725 +expand $Id$
726 726 +do not process $Id:
727 727 +xxx $
728 728
729 729 Status after rollback:
730 730
731 731 $ hg rollback
732 732 repository tip rolled back to revision 1 (undo commit)
733 733 working directory now based on revision 1
734 734 $ hg status
735 735 A c
736 736 $ hg update --clean
737 737 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
738 738
739 739 #if symlink
740 740
741 741 cp symlink file; hg cp -A symlink file (part2)
742 742 - copied symlink points to kw ignored file: do not overwrite
743 743
744 744 $ cat a > i
745 745 $ ln -s i symignored
746 746 $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
747 747 $ cp symignored x
748 748 $ hg copy --after --verbose symignored x
749 749 copying symignored to x
750 750 $ head -n 1 x
751 751 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
752 752 $ hg forget x
753 753 $ rm x
754 754
755 755 $ hg rollback
756 756 repository tip rolled back to revision 1 (undo commit)
757 757 working directory now based on revision 1
758 758 $ hg update --clean
759 759 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
760 760 $ rm i symignored
761 761
762 762 #endif
763 763
764 764 Custom keywordmaps as argument to kwdemo
765 765
766 766 $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
767 767 [extensions]
768 768 keyword =
769 769 [keyword]
770 770 ** =
771 771 b = ignore
772 772 demo.txt =
773 773 i = ignore
774 774 [keywordset]
775 775 svn = False
776 776 [keywordmaps]
777 777 Xinfo = {author}: {desc}
778 778 $Xinfo: test: hg keyword configuration and expansion example $
779 779
780 780 Configure custom keywordmaps
781 781
782 782 $ cat <<EOF >>$HGRCPATH
783 783 > [keywordmaps]
784 784 > Id = {file} {node|short} {date|rfc822date} {author|user}
785 785 > Xinfo = {author}: {desc}
786 786 > EOF
787 787
788 788 Cat and hg cat files before custom expansion
789 789
790 790 $ cat a b
791 791 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
792 792 do not process $Id:
793 793 xxx $
794 794 ignore $Id$
795 795 $ hg cat sym a b && echo
796 796 expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
797 797 do not process $Id:
798 798 xxx $
799 799 ignore $Id$
800 800 a
801 801
802 802 Write custom keyword and prepare multi-line commit message
803 803
804 804 $ echo '$Xinfo$' >> a
805 805 $ cat <<EOF >> log
806 806 > firstline
807 807 > secondline
808 808 > EOF
809 809
810 810 Interrupted commit should not change state
811 811
812 812 $ hg commit
813 813 abort: empty commit message
814 814 [255]
815 815 $ hg status
816 816 M a
817 817 ? c
818 818 ? log
819 819
820 820 Commit with multi-line message and custom expansion
821 821
822 822 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
823 823 committing files:
824 824 a
825 825 committing manifest
826 826 committing changelog
827 827 overwriting a expanding keywords
828 828 updating the branch cache
829 829 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
830 830 $ rm log
831 831
832 832 Stat, verify and show custom expansion (firstline)
833 833
834 834 $ hg status
835 835 ? c
836 836 $ hg verify
837 837 checking changesets
838 838 checking manifests
839 839 crosschecking files in changesets and manifests
840 840 checking files
841 841 3 files, 3 changesets, 4 total revisions
842 842 $ cat a b
843 843 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
844 844 do not process $Id:
845 845 xxx $
846 846 $Xinfo: User Name <user@example.com>: firstline $
847 847 ignore $Id$
848 848 $ hg cat sym a b && echo
849 849 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
850 850 do not process $Id:
851 851 xxx $
852 852 $Xinfo: User Name <user@example.com>: firstline $
853 853 ignore $Id$
854 854 a
855 855
856 856 annotate
857 857
858 858 $ hg annotate a
859 859 1: expand $Id$
860 860 1: do not process $Id:
861 861 1: xxx $
862 862 2: $Xinfo$
863 863
864 864 remove with status checks
865 865
866 866 $ hg debugrebuildstate
867 867 $ hg remove a
868 868 $ hg --debug commit -m rma
869 869 committing files:
870 870 committing manifest
871 871 committing changelog
872 872 updating the branch cache
873 873 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
874 874 $ hg status
875 875 ? c
876 876
877 877 Rollback, revert, and check expansion
878 878
879 879 $ hg rollback
880 880 repository tip rolled back to revision 2 (undo commit)
881 881 working directory now based on revision 2
882 882 $ hg status
883 883 R a
884 884 ? c
885 885 $ hg revert --no-backup --rev tip a
886 886 $ cat a
887 887 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
888 888 do not process $Id:
889 889 xxx $
890 890 $Xinfo: User Name <user@example.com>: firstline $
891 891
892 892 Clone to test global and local configurations
893 893
894 894 $ cd ..
895 895
896 896 Expansion in destination with global configuration
897 897
898 898 $ hg --quiet clone Test globalconf
899 899 $ cat globalconf/a
900 900 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
901 901 do not process $Id:
902 902 xxx $
903 903 $Xinfo: User Name <user@example.com>: firstline $
904 904
905 905 No expansion in destination with local configuration in origin only
906 906
907 907 $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
908 908 $ cat localconf/a
909 909 expand $Id$
910 910 do not process $Id:
911 911 xxx $
912 912 $Xinfo$
913 913
914 914 Clone to test incoming
915 915
916 916 $ hg clone -r1 Test Test-a
917 917 adding changesets
918 918 adding manifests
919 919 adding file changes
920 920 added 2 changesets with 3 changes to 3 files
921 921 updating to branch default
922 922 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
923 923 $ cd Test-a
924 924 $ cat <<EOF >> .hg/hgrc
925 925 > [paths]
926 926 > default = ../Test
927 927 > EOF
928 928 $ hg incoming
929 929 comparing with $TESTTMP/Test (glob)
930 930 searching for changes
931 931 changeset: 2:bb948857c743
932 932 tag: tip
933 933 user: User Name <user@example.com>
934 934 date: Thu Jan 01 00:00:02 1970 +0000
935 935 summary: firstline
936 936
937 937 Imported patch should not be rejected
938 938
939 939 >>> import re
940 940 >>> text = re.sub(r'(Id.*)', r'\1 rejecttest', open('a').read())
941 941 >>> open('a', 'wb').write(text)
942 942 $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
943 943 committing files:
944 944 a
945 945 committing manifest
946 946 committing changelog
947 947 overwriting a expanding keywords
948 948 updating the branch cache
949 949 committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
950 950 $ hg export -o ../rejecttest.diff tip
951 951 $ cd ../Test
952 952 $ hg import ../rejecttest.diff
953 953 applying ../rejecttest.diff
954 954 $ cat a b
955 955 expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
956 956 do not process $Id: rejecttest
957 957 xxx $
958 958 $Xinfo: User Name <user@example.com>: rejects? $
959 959 ignore $Id$
960 960
961 961 $ hg rollback
962 962 repository tip rolled back to revision 2 (undo import)
963 963 working directory now based on revision 2
964 964 $ hg update --clean
965 965 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
966 966
967 967 kwexpand/kwshrink on selected files
968 968
969 969 $ mkdir x
970 970 $ hg copy a x/a
971 971 $ hg --verbose kwshrink a
972 972 overwriting a shrinking keywords
973 973 - sleep required for dirstate.normal() check
974 974 $ sleep 1
975 975 $ hg status a
976 976 $ hg --verbose kwexpand a
977 977 overwriting a expanding keywords
978 978 $ hg status a
979 979
980 980 kwexpand x/a should abort
981 981
982 982 $ hg --verbose kwexpand x/a
983 983 abort: outstanding uncommitted changes
984 984 [255]
985 985 $ cd x
986 986 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
987 987 committing files:
988 988 x/a
989 989 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
990 990 committing manifest
991 991 committing changelog
992 992 overwriting x/a expanding keywords
993 993 updating the branch cache
994 994 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
995 995 $ cat a
996 996 expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
997 997 do not process $Id:
998 998 xxx $
999 999 $Xinfo: User Name <user@example.com>: xa $
1000 1000
1001 1001 kwshrink a inside directory x
1002 1002
1003 1003 $ hg --verbose kwshrink a
1004 1004 overwriting x/a shrinking keywords
1005 1005 $ cat a
1006 1006 expand $Id$
1007 1007 do not process $Id:
1008 1008 xxx $
1009 1009 $Xinfo$
1010 1010 $ cd ..
1011 1011
1012 1012 kwexpand nonexistent
1013 1013
1014 1014 $ hg kwexpand nonexistent
1015 1015 nonexistent:* (glob)
1016 1016
1017 1017
1018 1018 #if serve
1019 1019 hg serve
1020 1020 - expand with hgweb file
1021 1021 - no expansion with hgweb annotate/changeset/filediff/comparison
1022 1022 - expand with hgweb file, again
1023 1023 - check errors
1024 1024
1025 1025 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1026 1026 $ cat hg.pid >> $DAEMON_PIDS
1027 1027 $ get-with-headers.py localhost:$HGPORT 'file/tip/a/?style=raw'
1028 1028 200 Script output follows
1029 1029
1030 1030 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1031 1031 do not process $Id:
1032 1032 xxx $
1033 1033 $Xinfo: User Name <user@example.com>: firstline $
1034 1034 $ get-with-headers.py localhost:$HGPORT 'annotate/tip/a/?style=raw'
1035 1035 200 Script output follows
1036 1036
1037 1037
1038 1038 user@1: expand $Id$
1039 1039 user@1: do not process $Id:
1040 1040 user@1: xxx $
1041 1041 user@2: $Xinfo$
1042 1042
1043 1043
1044 1044
1045 1045
1046 1046 $ get-with-headers.py localhost:$HGPORT 'rev/tip/?style=raw'
1047 1047 200 Script output follows
1048 1048
1049 1049
1050 1050 # HG changeset patch
1051 1051 # User User Name <user@example.com>
1052 1052 # Date 3 0
1053 1053 # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
1054 1054 # Parent bb948857c743469b22bbf51f7ec8112279ca5d83
1055 1055 xa
1056 1056
1057 1057 diff -r bb948857c743 -r b4560182a3f9 x/a
1058 1058 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1059 1059 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000
1060 1060 @@ -0,0 +1,4 @@
1061 1061 +expand $Id$
1062 1062 +do not process $Id:
1063 1063 +xxx $
1064 1064 +$Xinfo$
1065 1065
1066 1066 $ get-with-headers.py localhost:$HGPORT 'diff/bb948857c743/a?style=raw'
1067 1067 200 Script output follows
1068 1068
1069 1069
1070 1070 diff -r ef63ca68695b -r bb948857c743 a
1071 1071 --- a/a Thu Jan 01 00:00:00 1970 +0000
1072 1072 +++ b/a Thu Jan 01 00:00:02 1970 +0000
1073 1073 @@ -1,3 +1,4 @@
1074 1074 expand $Id$
1075 1075 do not process $Id:
1076 1076 xxx $
1077 1077 +$Xinfo$
1078 1078
1079 1079
1080 1080
1081 1081
1082 1082 $ get-with-headers.py localhost:$HGPORT 'comparison/bb948857c743/a' | grep '\$[a-zA-Z]'
1083 1083 <td class="source equal"><a href="#l1r1"> 1</a> expand $Id$</td>
1084 1084 <td class="source equal"><a href="#l1r1"> 1</a> expand $Id$</td>
1085 1085 <td class="source equal"><a href="#l2r2"> 2</a> do not process $Id:</td>
1086 1086 <td class="source equal"><a href="#l2r2"> 2</a> do not process $Id:</td>
1087 1087 <td class="source insert"><a href="#r4"> 4</a> $Xinfo$</td>
1088 1088
1089 1089 (check "kwweb_skip"-ed webcommand doesn't suppress expanding keywords
1090 1090 at subsequent webcommands)
1091 1091
1092 1092 $ get-with-headers.py localhost:$HGPORT 'file/tip/a/?style=raw'
1093 1093 200 Script output follows
1094 1094
1095 1095 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1096 1096 do not process $Id:
1097 1097 xxx $
1098 1098 $Xinfo: User Name <user@example.com>: firstline $
1099 1099
1100 1100 $ killdaemons.py
1101 1101 $ cat errors.log
1102 1102 #endif
1103 1103
1104 1104 Prepare merge and resolve tests
1105 1105
1106 1106 $ echo '$Id$' > m
1107 1107 $ hg add m
1108 1108 $ hg commit -m 4kw
1109 1109 $ echo foo >> m
1110 1110 $ hg commit -m 5foo
1111 1111
1112 1112 simplemerge
1113 1113
1114 1114 $ hg update 4
1115 1115 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1116 1116 $ echo foo >> m
1117 1117 $ hg commit -m 6foo
1118 1118 created new head
1119 1119 $ hg merge
1120 1120 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1121 1121 (branch merge, don't forget to commit)
1122 1122 $ hg commit -m simplemerge
1123 1123 $ cat m
1124 1124 $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
1125 1125 foo
1126 1126
1127 1127 conflict: keyword should stay outside conflict zone
1128 1128
1129 1129 $ hg update 4
1130 1130 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1131 1131 $ echo bar >> m
1132 1132 $ hg commit -m 8bar
1133 1133 created new head
1134 1134 $ hg merge
1135 1135 merging m
1136 1136 warning: conflicts while merging m! (edit, then use 'hg resolve --mark')
1137 1137 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1138 1138 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1139 1139 [1]
1140 1140 $ cat m
1141 1141 $Id$
1142 1142 <<<<<<< working copy: 88a80c8d172e - test: 8bar
1143 1143 bar
1144 1144 =======
1145 1145 foo
1146 1146 >>>>>>> merge rev: 85d2d2d732a5 - test: simplemerge
1147 1147
1148 1148 resolve to local, m must contain hash of last change (local parent)
1149 1149
1150 1150 $ hg resolve -t internal:local -a
1151 1151 (no more unresolved files)
1152 1152 $ hg commit -m localresolve
1153 1153 $ cat m
1154 1154 $Id: m 88a80c8d172e Thu, 01 Jan 1970 00:00:00 +0000 test $
1155 1155 bar
1156 1156
1157 1157 Test restricted mode with transplant -b
1158 1158
1159 1159 $ hg update 6
1160 1160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1161 1161 $ hg branch foo
1162 1162 marked working directory as branch foo
1163 1163 (branches are permanent and global, did you want a bookmark?)
1164 1164 $ mv a a.bak
1165 1165 $ echo foobranch > a
1166 1166 $ cat a.bak >> a
1167 1167 $ rm a.bak
1168 1168 $ hg commit -m 9foobranch
1169 1169 $ hg update default
1170 1170 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1171 1171 $ hg -y transplant -b foo tip
1172 1172 applying 4aa30d025d50
1173 1173 4aa30d025d50 transplanted to e00abbf63521
1174 1174
1175 1175 Expansion in changeset but not in file
1176 1176
1177 1177 $ hg tip -p
1178 1178 changeset: 11:e00abbf63521
1179 1179 tag: tip
1180 1180 parent: 9:800511b3a22d
1181 1181 user: test
1182 1182 date: Thu Jan 01 00:00:00 1970 +0000
1183 1183 summary: 9foobranch
1184 1184
1185 1185 diff -r 800511b3a22d -r e00abbf63521 a
1186 1186 --- a/a Thu Jan 01 00:00:00 1970 +0000
1187 1187 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1188 1188 @@ -1,3 +1,4 @@
1189 1189 +foobranch
1190 1190 expand $Id$
1191 1191 do not process $Id:
1192 1192 xxx $
1193 1193
1194 1194 $ head -n 2 a
1195 1195 foobranch
1196 1196 expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1197 1197
1198 1198 Turn off expansion
1199 1199
1200 1200 $ hg -q rollback
1201 1201 $ hg -q update -C
1202 1202
1203 1203 kwshrink with unknown file u
1204 1204
1205 1205 $ cp a u
1206 1206 $ hg --verbose kwshrink
1207 1207 overwriting a shrinking keywords
1208 1208 overwriting m shrinking keywords
1209 1209 overwriting x/a shrinking keywords
1210 1210
1211 1211 Keywords shrunk in working directory, but not yet disabled
1212 1212 - cat shows unexpanded keywords
1213 1213 - hg cat shows expanded keywords
1214 1214
1215 1215 $ cat a b
1216 1216 expand $Id$
1217 1217 do not process $Id:
1218 1218 xxx $
1219 1219 $Xinfo$
1220 1220 ignore $Id$
1221 1221 $ hg cat sym a b && echo
1222 1222 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1223 1223 do not process $Id:
1224 1224 xxx $
1225 1225 $Xinfo: User Name <user@example.com>: firstline $
1226 1226 ignore $Id$
1227 1227 a
1228 1228
1229 1229 Now disable keyword expansion
1230 1230
1231 1231 $ cp $HGRCPATH $HGRCPATH.backup
1232 1232 $ rm "$HGRCPATH"
1233 1233 $ cat a b
1234 1234 expand $Id$
1235 1235 do not process $Id:
1236 1236 xxx $
1237 1237 $Xinfo$
1238 1238 ignore $Id$
1239 1239 $ hg cat sym a b && echo
1240 1240 expand $Id$
1241 1241 do not process $Id:
1242 1242 xxx $
1243 1243 $Xinfo$
1244 1244 ignore $Id$
1245 1245 a
1246 1246
1247 1247 enable keyword expansion again
1248 1248
1249 1249 $ cat $HGRCPATH.backup >> $HGRCPATH
1250 1250
1251 1251 Test restricted mode with unshelve
1252 1252
1253 1253 $ cat <<EOF >> $HGRCPATH
1254 1254 > [extensions]
1255 1255 > shelve =
1256 1256 > EOF
1257 1257
1258 1258 $ echo xxxx >> a
1259 1259 $ hg diff
1260 1260 diff -r 800511b3a22d a
1261 1261 --- a/a Thu Jan 01 00:00:00 1970 +0000
1262 1262 +++ b/a * (glob)
1263 1263 @@ -2,3 +2,4 @@
1264 1264 do not process $Id:
1265 1265 xxx $
1266 1266 $Xinfo$
1267 1267 +xxxx
1268 1268 $ hg shelve -q --name tmp
1269 1269 $ hg shelve --list --patch
1270 1270 tmp (*)* changes to: localresolve (glob)
1271 1271
1272 1272 diff --git a/a b/a
1273 1273 --- a/a
1274 1274 +++ b/a
1275 1275 @@ -2,3 +2,4 @@
1276 1276 do not process $Id:
1277 1277 xxx $
1278 1278 $Xinfo$
1279 1279 +xxxx
1280 1280
1281 1281 $ hg update -q -C 10
1282 1282 $ hg unshelve -q tmp
1283 1283 $ hg diff
1284 1284 diff -r 4aa30d025d50 a
1285 1285 --- a/a Thu Jan 01 00:00:00 1970 +0000
1286 1286 +++ b/a * (glob)
1287 1287 @@ -3,3 +3,4 @@
1288 1288 do not process $Id:
1289 1289 xxx $
1290 1290 $Xinfo$
1291 1291 +xxxx
1292 1292
1293 1293 Test restricted mode with rebase
1294 1294
1295 1295 $ cat <<EOF >> $HGRCPATH
1296 1296 > [extensions]
1297 1297 > rebase =
1298 1298 > EOF
1299 1299
1300 1300 $ hg update -q -C 9
1301 1301
1302 1302 $ echo xxxx >> a
1303 1303 $ hg commit -m '#11'
1304 1304 $ hg diff -c 11
1305 1305 diff -r 800511b3a22d -r b07670694489 a
1306 1306 --- a/a Thu Jan 01 00:00:00 1970 +0000
1307 1307 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1308 1308 @@ -2,3 +2,4 @@
1309 1309 do not process $Id:
1310 1310 xxx $
1311 1311 $Xinfo$
1312 1312 +xxxx
1313 1313
1314 1314 $ hg diff -c 10
1315 1315 diff -r 27d48ee14f67 -r 4aa30d025d50 a
1316 1316 --- a/a Thu Jan 01 00:00:00 1970 +0000
1317 1317 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1318 1318 @@ -1,3 +1,4 @@
1319 1319 +foobranch
1320 1320 expand $Id$
1321 1321 do not process $Id:
1322 1322 xxx $
1323 1323
1324 1324 $ hg rebase -q -s 10 -d 11 --keep
1325 1325 $ hg diff -r 9 -r 12 a
1326 1326 diff -r 800511b3a22d -r 1939b927726c a
1327 1327 --- a/a Thu Jan 01 00:00:00 1970 +0000
1328 1328 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1329 1329 @@ -1,4 +1,6 @@
1330 1330 +foobranch
1331 1331 expand $Id$
1332 1332 do not process $Id:
1333 1333 xxx $
1334 1334 $Xinfo$
1335 1335 +xxxx
1336 1336
1337 1337 Test restricted mode with graft
1338 1338
1339 1339 $ hg graft -q 10
1340 1340 $ hg diff -r 9 -r 13 a
1341 1341 diff -r 800511b3a22d -r 01a68de1003a a
1342 1342 --- a/a Thu Jan 01 00:00:00 1970 +0000
1343 1343 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1344 1344 @@ -1,4 +1,6 @@
1345 1345 +foobranch
1346 1346 expand $Id$
1347 1347 do not process $Id:
1348 1348 xxx $
1349 1349 $Xinfo$
1350 1350 +xxxx
1351 1351
1352 1352 Test restricted mode with backout
1353 1353
1354 1354 $ hg backout -q 11 --no-commit
1355 1355 $ hg diff a
1356 1356 diff -r 01a68de1003a a
1357 1357 --- a/a Thu Jan 01 00:00:00 1970 +0000
1358 1358 +++ b/a * (glob)
1359 1359 @@ -3,4 +3,3 @@
1360 1360 do not process $Id:
1361 1361 xxx $
1362 1362 $Xinfo$
1363 1363 -xxxx
1364 1364
1365 1365 Test restricted mode with histedit
1366 1366
1367 1367 $ cat <<EOF >> $HGRCPATH
1368 1368 > [extensions]
1369 1369 > histedit =
1370 1370 > EOF
1371 1371
1372 1372 $ hg commit -m 'backout #11'
1373 1373 $ hg histedit -q --command - 13 <<EOF
1374 1374 > pick 49f5f2d940c3 14 backout #11
1375 1375 > pick 01a68de1003a 13 9foobranch
1376 1376 > EOF
1377 1377
1378 1378 Test restricted mode with fetch (with merge)
1379 1379
1380 1380 $ cat <<EOF >> $HGRCPATH
1381 1381 > [extensions]
1382 1382 > fetch =
1383 1383 > EOF
1384 1384
1385 1385 $ hg clone -q -r 9 . ../fetch-merge
1386 1386 $ cd ../fetch-merge
1387 1387 $ hg -R ../Test export 10 | hg import -q -
1388 1388 $ hg fetch -q -r 11
1389 1389 $ hg diff -r 9 a
1390 1390 diff -r 800511b3a22d a
1391 1391 --- a/a Thu Jan 01 00:00:00 1970 +0000
1392 1392 +++ b/a * (glob)
1393 1393 @@ -1,4 +1,6 @@
1394 1394 +foobranch
1395 1395 expand $Id$
1396 1396 do not process $Id:
1397 1397 xxx $
1398 1398 $Xinfo$
1399 1399 +xxxx
1400 1400
1401 1401 Test that patch.diff(), which is implied by "hg diff" or so, doesn't
1402 1402 suppress expanding keywords at subsequent commands
1403 1403
1404 1404 #if windows
1405 1405 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
1406 1406 #else
1407 1407 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
1408 1408 #endif
1409 1409 $ export PYTHONPATH
1410 1410
1411 1411 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
1412 1412 $ mv $HGRCPATH.new $HGRCPATH
1413 1413
1414 1414 >>> from __future__ import print_function
1415 >>> from hgclient import readchannel, runcommand, check
1415 >>> from hgclient import check, readchannel, runcommand
1416 1416 >>> @check
1417 1417 ... def check(server):
1418 1418 ... # hello block
1419 1419 ... readchannel(server)
1420 1420 ...
1421 1421 ... runcommand(server, ['cat', 'm'])
1422 1422 ... runcommand(server, ['diff', '-c', '.', 'm'])
1423 1423 ... runcommand(server, ['cat', 'm'])
1424 1424 *** runcommand cat m
1425 1425 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1426 1426 bar
1427 1427 *** runcommand diff -c . m
1428 1428 *** runcommand cat m
1429 1429 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1430 1430 bar
1431 1431
1432 1432 $ cd ..
1433 1433
1434 1434 #if serve
1435 1435
1436 1436 Test that keywords are expanded only in repositories, which enable
1437 1437 keyword extension, even if multiple repositories are served in a
1438 1438 process
1439 1439
1440 1440 $ cat >> fetch-merge/.hg/hgrc <<EOF
1441 1441 > [extensions]
1442 1442 > keyword = !
1443 1443 > EOF
1444 1444
1445 1445 $ cat > paths.conf <<EOF
1446 1446 > [paths]
1447 1447 > enabled=Test
1448 1448 > disabled=fetch-merge
1449 1449 > EOF
1450 1450
1451 1451 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log --webdir-conf paths.conf
1452 1452 $ cat hg.pid >> $DAEMON_PIDS
1453 1453
1454 1454 $ get-with-headers.py localhost:$HGPORT 'enabled/file/tip/m/?style=raw'
1455 1455 200 Script output follows
1456 1456
1457 1457 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1458 1458 bar
1459 1459
1460 1460 $ get-with-headers.py localhost:$HGPORT 'disabled/file/tip/m/?style=raw'
1461 1461 200 Script output follows
1462 1462
1463 1463 $Id$
1464 1464 bar
1465 1465
1466 1466 (check expansion again, for safety)
1467 1467
1468 1468 $ get-with-headers.py localhost:$HGPORT 'enabled/file/tip/m/?style=raw'
1469 1469 200 Script output follows
1470 1470
1471 1471 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1472 1472 bar
1473 1473
1474 1474 $ killdaemons.py
1475 1475 #endif
General Comments 0
You need to be logged in to leave comments. Login now