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