comparison tests/test-notify.t @ 43334:4128ffba4431 stable

tests: handle Message-Id email header possible wrapping The "Message-Id" header will get wrapped with a new line when exceeding 75 characters on Python 3 (see changeset 7d4f2e4899c5 introducing usage of email.header.Header.encode and respective doc). This will occur in an unpredictable manner depending on the hostname's length. To make the test output consistent across Python versions and hostname configuration, we add a filter to unwrap this header value.
author Denis Laxalde <denis@laxalde.org>
date Sun, 27 Oct 2019 18:12:24 +0100
parents 90ee1f61504e
children 947e6df4ff77
comparison
equal deleted inserted replaced
43333:91c746a77fa3 43334:4128ffba4431
194 194
195 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because 195 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
196 of the very long subject line 196 of the very long subject line
197 pull (minimal config) 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 pulling from ../a 202 pulling from ../a
201 searching for changes 203 searching for changes
202 adding changesets 204 adding changesets
203 adding manifests 205 adding manifests
204 adding file changes 206 adding file changes
209 Content-Transfer-Encoding: 7bit 211 Content-Transfer-Encoding: 7bit
210 Date: * (glob) 212 Date: * (glob)
211 Subject: changeset in $TESTTMP/b: b 213 Subject: changeset in $TESTTMP/b: b
212 From: test@example.com 214 From: test@example.com
213 X-Hg-Notification: changeset 00a13f371396 215 X-Hg-Notification: changeset 00a13f371396
214 Message-Id: <hg.ba3098a36bd4c297288d16788623a841f81f618ea961a0f0fd65de7eb1191b66@example.com> (no-py3 !) 216 Message-Id: <hg.ba3098a36bd4c297288d16788623a841f81f618ea961a0f0fd65de7eb1191b66@example.com>
215 Message-Id: <hg.ba3098a36bd4c297288d16788623a841f81f618ea961a0f0fd65de7eb1191b66@example.com> (py3 !)
216 To: baz@example.com, foo@bar 217 To: baz@example.com, foo@bar
217 218
218 changeset 00a13f371396 in $TESTTMP/b 219 changeset 00a13f371396 in $TESTTMP/b
219 details: $TESTTMP/b?cmd=changeset;node=00a13f371396 220 details: $TESTTMP/b?cmd=changeset;node=00a13f371396
220 description: b 221 description: b
254 255
255 pull 256 pull
256 257
257 $ hg --cwd b rollback 258 $ hg --cwd b rollback
258 repository tip rolled back to revision 0 (undo pull) 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 pulling from ../a 263 pulling from ../a
261 searching for changes 264 searching for changes
262 adding changesets 265 adding changesets
263 adding manifests 266 adding manifests
264 adding file changes 267 adding file changes
302 305
303 pull 306 pull
304 307
305 $ hg --cwd b rollback 308 $ hg --cwd b rollback
306 repository tip rolled back to revision 0 (undo pull) 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 pulling from ../a 313 pulling from ../a
309 searching for changes 314 searching for changes
310 adding changesets 315 adding changesets
311 adding manifests 316 adding manifests
312 adding file changes 317 adding file changes
353 $ hg merge 358 $ hg merge
354 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
355 (branch merge, don't forget to commit) 360 (branch merge, don't forget to commit)
356 $ hg ci -m merge -d '3 0' 361 $ hg ci -m merge -d '3 0'
357 $ cd .. 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 pulling from ../a 366 pulling from ../a
360 searching for changes 367 searching for changes
361 adding changesets 368 adding changesets
362 adding manifests 369 adding manifests
363 adding file changes 370 adding file changes
419 > EOF 426 > EOF
420 $ echo a >> a/a 427 $ echo a >> a/a
421 $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \ 428 $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
422 > -m `"$PYTHON" -c 'import sys; getattr(sys.stdout, "buffer", sys.stdout).write(b"\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4")'` 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 $ hg --traceback --cwd b --encoding utf-8 pull ../a | \ 430 $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
431 > "$PYTHON" $TESTDIR/unwrap-message-id.py | \
424 > "$PYTHON" $TESTTMP/filter.py 432 > "$PYTHON" $TESTTMP/filter.py
425 pulling from ../a 433 pulling from ../a
426 searching for changes 434 searching for changes
427 adding changesets 435 adding changesets
428 adding manifests 436 adding manifests
473 adding file changes 481 adding file changes
474 added 1 changesets with 1 changes to 1 files 482 added 1 changesets with 1 changes to 1 files
475 new changesets a846b5f6ebb7 483 new changesets a846b5f6ebb7
476 notify: sending 2 subscribers 1 changes 484 notify: sending 2 subscribers 1 changes
477 (run 'hg update' to get a working copy) 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 From test@test.com ... ... .. ..:..:.. .... (re) 487 From test@test.com ... ... .. ..:..:.. .... (re)
480 MIME-Version: 1.0 488 MIME-Version: 1.0
481 Content-Type: text/plain; charset="*" (glob) 489 Content-Type: text/plain; charset="*" (glob)
482 Content-Transfer-Encoding: quoted-printable 490 Content-Transfer-Encoding: quoted-printable
483 X-Test: foo 491 X-Test: foo
533 $ hg --cwd a branch test 541 $ hg --cwd a branch test
534 marked working directory as branch test 542 marked working directory as branch test
535 (branches are permanent and global, did you want a bookmark?) 543 (branches are permanent and global, did you want a bookmark?)
536 $ echo a >> a/a 544 $ echo a >> a/a
537 $ hg --cwd a ci -m test -d '1 0' 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 pulling from ../a 549 pulling from ../a
540 searching for changes 550 searching for changes
541 adding changesets 551 adding changesets
542 adding manifests 552 adding manifests
543 adding file changes 553 adding file changes
563 573
564 $ hg --cwd a update default 574 $ hg --cwd a update default
565 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 575 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
566 $ echo a >> a/a 576 $ echo a >> a/a
567 $ hg --cwd a ci -m test -d '1 0' 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 pulling from ../a 581 pulling from ../a
570 searching for changes 582 searching for changes
571 adding changesets 583 adding changesets
572 adding manifests 584 adding manifests
573 adding file changes 585 adding file changes
592 604
593 $ grep -v '^template =' $HGRCPATH > "$HGRCPATH.new" 605 $ grep -v '^template =' $HGRCPATH > "$HGRCPATH.new"
594 $ mv "$HGRCPATH.new" $HGRCPATH 606 $ mv "$HGRCPATH.new" $HGRCPATH
595 $ echo a >> a/a 607 $ echo a >> a/a
596 $ hg --cwd a commit -m 'default template' 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 MIME-Version: 1.0 612 MIME-Version: 1.0
599 Content-Type: text/plain; charset="us-ascii" 613 Content-Type: text/plain; charset="us-ascii"
600 Content-Transfer-Encoding: 7bit 614 Content-Transfer-Encoding: 7bit
601 Date: * (glob) 615 Date: * (glob)
602 Subject: changeset in b: default template 616 Subject: changeset in b: default template
621 > [notify] 635 > [notify]
622 > style = $TESTTMP/notifystyle.map 636 > style = $TESTTMP/notifystyle.map
623 > EOF 637 > EOF
624 $ echo a >> a/a 638 $ echo a >> a/a
625 $ hg --cwd a commit -m 'with style' 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 MIME-Version: 1.0 643 MIME-Version: 1.0
628 Content-Type: text/plain; charset="us-ascii" 644 Content-Type: text/plain; charset="us-ascii"
629 Content-Transfer-Encoding: 7bit 645 Content-Transfer-Encoding: 7bit
630 Date: * (glob) 646 Date: * (glob)
631 Subject: with style 647 Subject: with style
644 > {""} 660 > {""}
645 > {desc} 661 > {desc}
646 > EOF 662 > EOF
647 $ echo a >> a/a 663 $ echo a >> a/a
648 $ hg --cwd a commit -m 'with template' 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 MIME-Version: 1.0 668 MIME-Version: 1.0
651 Content-Type: text/plain; charset="us-ascii" 669 Content-Type: text/plain; charset="us-ascii"
652 Content-Transfer-Encoding: 7bit 670 Content-Transfer-Encoding: 7bit
653 Date: * (glob) 671 Date: * (glob)
654 Subject: 14721b538ae3: with template 672 Subject: 14721b538ae3: with template
675 > return a + b + c + d; 693 > return a + b + c + d;
676 > } 694 > }
677 > EOF 695 > EOF
678 $ hg commit -Am addfunction 696 $ hg commit -Am addfunction
679 adding f1 697 adding f1
680 $ hg --cwd ../b pull ../a 698 $ hg --cwd ../b pull ../a | \
699 > "$PYTHON" $TESTDIR/unwrap-message-id.py
681 pulling from ../a 700 pulling from ../a
682 searching for changes 701 searching for changes
683 adding changesets 702 adding changesets
684 adding manifests 703 adding manifests
685 adding file changes 704 adding file changes
718 > int e = 3; 737 > int e = 3;
719 > return a + b + c + e; 738 > return a + b + c + e;
720 > } 739 > }
721 > EOF 740 > EOF
722 $ hg commit -m changefunction 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 pulling from ../a 744 pulling from ../a
725 searching for changes 745 searching for changes
726 adding changesets 746 adding changesets
727 adding manifests 747 adding manifests
728 adding file changes 748 adding file changes