tests/test-notify.t
changeset 44627 947e6df4ff77
parent 43334 4128ffba4431
child 44655 47e6ec977555
equal deleted inserted replaced
44626:11f284c8c5e4 44627:947e6df4ff77
     4   > import sys
     4   > import sys
     5   > print(re.sub("\n[ \t]", " ", sys.stdin.read()), end="")
     5   > print(re.sub("\n[ \t]", " ", sys.stdin.read()), end="")
     6   > EOF
     6   > EOF
     7 
     7 
     8   $ cat <<EOF >> $HGRCPATH
     8   $ cat <<EOF >> $HGRCPATH
       
     9   > [experimental]
       
    10   > evolution = true
       
    11   > 
     9   > [extensions]
    12   > [extensions]
    10   > notify=
    13   > notify=
       
    14   > strip=
       
    15   > 
       
    16   > [phases]
       
    17   > publish=False
    11   > 
    18   > 
    12   > [hooks]
    19   > [hooks]
    13   > incoming.notify = python:hgext.notify.hook
    20   > incoming.notify = python:hgext.notify.hook
    14   > 
    21   > 
    15   > [notify]
    22   > [notify]
    16   > sources = pull
    23   > sources = pull
    17   > diffstat = False
    24   > diffstat = False
       
    25   > reply-to-predecessor = True
       
    26   > messageidseed = notifyseed
    18   > 
    27   > 
    19   > [usersubs]
    28   > [usersubs]
    20   > foo@bar = *
    29   > foo@bar = *
    21   > 
    30   > 
    22   > [reposubs]
    31   > [reposubs]
   149   notify.fromauthor
   158   notify.fromauthor
   150     If set, use the committer of the first changeset in a changegroup for the
   159     If set, use the committer of the first changeset in a changegroup for the
   151     "From" field of the notification mail. If not set, take the user from the
   160     "From" field of the notification mail. If not set, take the user from the
   152     pushing repo.  Default: False.
   161     pushing repo.  Default: False.
   153   
   162   
       
   163   notify.reply-to-predecessor (EXPERIMENTAL)
       
   164     If set and the changeset has a predecessor in the repository, try to thread
       
   165     the notification mail with the predecessor. This adds the "In-Reply-To"
       
   166     header to the notification mail with a reference to the predecessor with the
       
   167     smallest revision number. Mail threads can still be torn, especially when
       
   168     changesets are folded.
       
   169   
       
   170     This option must  be used in combination with "notify.messageidseed".
       
   171   
   154   If set, the following entries will also be used to customize the
   172   If set, the following entries will also be used to customize the
   155   notifications:
   173   notifications:
   156   
   174   
   157   email.from
   175   email.from
   158     Email "From" address to use if none can be found in the generated email
   176     Email "From" address to use if none can be found in the generated email
   203   searching for changes
   221   searching for changes
   204   adding changesets
   222   adding changesets
   205   adding manifests
   223   adding manifests
   206   adding file changes
   224   adding file changes
   207   added 1 changesets with 2 changes to 2 files
   225   added 1 changesets with 2 changes to 2 files
   208   new changesets 00a13f371396
   226   new changesets 00a13f371396 (1 drafts)
   209   MIME-Version: 1.0
   227   MIME-Version: 1.0
   210   Content-Type: text/plain; charset="us-ascii"
   228   Content-Type: text/plain; charset="us-ascii"
   211   Content-Transfer-Encoding: 7bit
   229   Content-Transfer-Encoding: 7bit
   212   Date: * (glob)
   230   Date: * (glob)
   213   Subject: changeset in $TESTTMP/b: b
   231   Subject: changeset in $TESTTMP/b: b
   264   searching for changes
   282   searching for changes
   265   adding changesets
   283   adding changesets
   266   adding manifests
   284   adding manifests
   267   adding file changes
   285   adding file changes
   268   added 1 changesets with 2 changes to 2 files
   286   added 1 changesets with 2 changes to 2 files
   269   new changesets 00a13f371396
   287   new changesets 00a13f371396 (1 drafts)
   270   MIME-Version: 1.0
   288   MIME-Version: 1.0
   271   Content-Type: text/plain; charset="us-ascii"
   289   Content-Type: text/plain; charset="us-ascii"
   272   Content-Transfer-Encoding: 7bit
   290   Content-Transfer-Encoding: 7bit
   273   X-Test: foo
   291   X-Test: foo
   274   Date: * (glob)
   292   Date: * (glob)
   314   searching for changes
   332   searching for changes
   315   adding changesets
   333   adding changesets
   316   adding manifests
   334   adding manifests
   317   adding file changes
   335   adding file changes
   318   added 1 changesets with 2 changes to 2 files
   336   added 1 changesets with 2 changes to 2 files
   319   new changesets 00a13f371396
   337   new changesets 00a13f371396 (1 drafts)
   320   MIME-Version: 1.0
   338   MIME-Version: 1.0
   321   Content-Type: text/plain; charset="us-ascii"
   339   Content-Type: text/plain; charset="us-ascii"
   322   Content-Transfer-Encoding: 7bit
   340   Content-Transfer-Encoding: 7bit
   323   X-Test: foo
   341   X-Test: foo
   324   Date: * (glob)
   342   Date: * (glob)
   367   searching for changes
   385   searching for changes
   368   adding changesets
   386   adding changesets
   369   adding manifests
   387   adding manifests
   370   adding file changes
   388   adding file changes
   371   added 2 changesets with 0 changes to 0 files
   389   added 2 changesets with 0 changes to 0 files
   372   new changesets 3332653e1f3c:fccf66cd0c35
   390   new changesets 3332653e1f3c:fccf66cd0c35 (2 drafts)
   373   MIME-Version: 1.0
   391   MIME-Version: 1.0
   374   Content-Type: text/plain; charset="us-ascii"
   392   Content-Type: text/plain; charset="us-ascii"
   375   Content-Transfer-Encoding: 7bit
   393   Content-Transfer-Encoding: 7bit
   376   X-Test: foo
   394   X-Test: foo
   377   Date: * (glob)
   395   Date: * (glob)
   434   searching for changes
   452   searching for changes
   435   adding changesets
   453   adding changesets
   436   adding manifests
   454   adding manifests
   437   adding file changes
   455   adding file changes
   438   added 1 changesets with 1 changes to 1 files
   456   added 1 changesets with 1 changes to 1 files
   439   new changesets 0f25f9c22b4c
   457   new changesets 0f25f9c22b4c (1 drafts)
   440   MIME-Version: 1.0
   458   MIME-Version: 1.0
   441   Content-Type: text/plain; charset="us-ascii"
   459   Content-Type: text/plain; charset="us-ascii"
   442   Content-Transfer-Encoding: 8bit
   460   Content-Transfer-Encoding: 8bit
   443   X-Test: foo
   461   X-Test: foo
   444   Date: * (glob)
   462   Date: * (glob)
   478   searching for changes
   496   searching for changes
   479   adding changesets
   497   adding changesets
   480   adding manifests
   498   adding manifests
   481   adding file changes
   499   adding file changes
   482   added 1 changesets with 1 changes to 1 files
   500   added 1 changesets with 1 changes to 1 files
   483   new changesets a846b5f6ebb7
   501   new changesets a846b5f6ebb7 (1 drafts)
   484   notify: sending 2 subscribers 1 changes
   502   notify: sending 2 subscribers 1 changes
   485   (run 'hg update' to get a working copy)
   503   (run 'hg update' to get a working copy)
   486   $ cat b/mbox | "$PYTHON" $TESTDIR/unwrap-message-id.py | "$PYTHON" $TESTTMP/filter.py
   504   $ cat b/mbox | "$PYTHON" $TESTDIR/unwrap-message-id.py | "$PYTHON" $TESTTMP/filter.py
   487   From test@test.com ... ... .. ..:..:.. .... (re)
   505   From test@test.com ... ... .. ..:..:.. .... (re)
   488   MIME-Version: 1.0
   506   MIME-Version: 1.0
   491   X-Test: foo
   509   X-Test: foo
   492   Date: * (glob)
   510   Date: * (glob)
   493   Subject: long line
   511   Subject: long line
   494   From: test@test.com
   512   From: test@test.com
   495   X-Hg-Notification: changeset a846b5f6ebb7
   513   X-Hg-Notification: changeset a846b5f6ebb7
   496   Message-Id: <hg.a846b5f6ebb7.*.*@*> (glob)
   514   Message-Id: <hg.e7dc7658565793ff33c797e72b7d1f3799347b042af3c40df6d17c8d5c3e560a@test.com>
   497   To: baz@test.com, foo@bar
   515   To: baz@test.com, foo@bar
   498   
   516   
   499   changeset a846b5f6ebb7 in b
   517   changeset a846b5f6ebb7 in b
   500   description: long line
   518   description: long line
   501   diffstat:
   519   diffstat:
   541   $ hg --cwd a branch test
   559   $ hg --cwd a branch test
   542   marked working directory as branch test
   560   marked working directory as branch test
   543   (branches are permanent and global, did you want a bookmark?)
   561   (branches are permanent and global, did you want a bookmark?)
   544   $ echo a >> a/a
   562   $ echo a >> a/a
   545   $ hg --cwd a ci -m test -d '1 0'
   563   $ hg --cwd a ci -m test -d '1 0'
       
   564   $ echo a >> a/a
       
   565   $ hg --cwd a ci -m test -d '1 0'
   546   $ hg --traceback --cwd b pull ../a | \
   566   $ hg --traceback --cwd b pull ../a | \
   547   >  "$PYTHON" $TESTDIR/unwrap-message-id.py | \
   567   >  "$PYTHON" $TESTDIR/unwrap-message-id.py | \
   548   >  "$PYTHON" $TESTTMP/filter.py
   568   >  "$PYTHON" $TESTTMP/filter.py
   549   pulling from ../a
   569   pulling from ../a
   550   searching for changes
   570   searching for changes
   551   adding changesets
   571   adding changesets
   552   adding manifests
   572   adding manifests
   553   adding file changes
   573   adding file changes
   554   added 1 changesets with 1 changes to 1 files
   574   added 2 changesets with 2 changes to 1 files
   555   new changesets f7e5aaed4080
   575   new changesets f7e5aaed4080:485bf79b9464 (2 drafts)
   556   MIME-Version: 1.0
   576   MIME-Version: 1.0
   557   Content-Type: text/plain; charset="us-ascii"
   577   Content-Type: text/plain; charset="us-ascii"
   558   Content-Transfer-Encoding: 7bit
   578   Content-Transfer-Encoding: 7bit
   559   X-Test: foo
   579   X-Test: foo
   560   Date: * (glob)
   580   Date: * (glob)
   561   Subject: test
   581   Subject: test
   562   From: test@test.com
   582   From: test@test.com
   563   X-Hg-Notification: changeset f7e5aaed4080
   583   X-Hg-Notification: changeset f7e5aaed4080
   564   Message-Id: <hg.f7e5aaed4080.*.*@*> (glob)
   584   Message-Id: <hg.12e9ae631e2529e9cfbe7a93be0dd8a401280700640f802a60f20d7be659251d@test.com>
   565   To: baz@test.com, foo@bar, notify@example.com
   585   To: baz@test.com, foo@bar, notify@example.com
   566   
   586   
   567   changeset f7e5aaed4080 in b
   587   changeset f7e5aaed4080 in b
       
   588   description: test
       
   589   MIME-Version: 1.0
       
   590   Content-Type: text/plain; charset="us-ascii"
       
   591   Content-Transfer-Encoding: 7bit
       
   592   X-Test: foo
       
   593   Date: * (glob)
       
   594   Subject: test
       
   595   From: test@test.com
       
   596   X-Hg-Notification: changeset 485bf79b9464
       
   597   Message-Id: <hg.15281d60c27d9d5fb70435d33ebc24cb5aa580f2535988dcb9923c26e8bc5c47@test.com>
       
   598   To: baz@test.com, foo@bar, notify@example.com
       
   599   
       
   600   changeset 485bf79b9464 in b
   568   description: test
   601   description: test
   569   (run 'hg update' to get a working copy)
   602   (run 'hg update' to get a working copy)
   570 
   603 
   571 revset selection: don't send to address that waits for mails
   604 revset selection: don't send to address that waits for mails
   572 from different branch
   605 from different branch
   582   searching for changes
   615   searching for changes
   583   adding changesets
   616   adding changesets
   584   adding manifests
   617   adding manifests
   585   adding file changes
   618   adding file changes
   586   added 1 changesets with 0 changes to 0 files (+1 heads)
   619   added 1 changesets with 0 changes to 0 files (+1 heads)
   587   new changesets 645eb6690ecf
   620   new changesets 645eb6690ecf (1 drafts)
   588   MIME-Version: 1.0
   621   MIME-Version: 1.0
   589   Content-Type: text/plain; charset="us-ascii"
   622   Content-Type: text/plain; charset="us-ascii"
   590   Content-Transfer-Encoding: 7bit
   623   Content-Transfer-Encoding: 7bit
   591   X-Test: foo
   624   X-Test: foo
   592   Date: * (glob)
   625   Date: * (glob)
   593   Subject: test
   626   Subject: test
   594   From: test@test.com
   627   From: test@test.com
   595   X-Hg-Notification: changeset 645eb6690ecf
   628   X-Hg-Notification: changeset 645eb6690ecf
   596   Message-Id: <hg.645eb6690ecf.*.*@*> (glob)
   629   Message-Id: <hg.ba26b2c63e7deb44e86c934aeea147edde12a11b6ac94bda103dcab5028dc928@test.com>
   597   To: baz@test.com, foo@bar
   630   To: baz@test.com, foo@bar
   598   
   631   
   599   changeset 645eb6690ecf in b
   632   changeset 645eb6690ecf in b
   600   description: test
   633   description: test
   601   (run 'hg heads' to see heads)
   634   (run 'hg heads' to see heads)
   614   Content-Transfer-Encoding: 7bit
   647   Content-Transfer-Encoding: 7bit
   615   Date: * (glob)
   648   Date: * (glob)
   616   Subject: changeset in b: default template
   649   Subject: changeset in b: default template
   617   From: test@test.com
   650   From: test@test.com
   618   X-Hg-Notification: changeset 5cd4346eed47
   651   X-Hg-Notification: changeset 5cd4346eed47
   619   Message-Id: <hg.5cd4346eed47.*.*@*> (glob)
   652   Message-Id: <hg.8caa7941b24fc673d10910cb072e2d167362a3c5111cafefa47190d9b831f0a3@test.com>
   620   To: baz@test.com, foo@bar
   653   To: baz@test.com, foo@bar
   621   
   654   
   622   changeset 5cd4346eed47 in $TESTTMP/b
   655   changeset 5cd4346eed47 in $TESTTMP/b
   623   details: http://test/b?cmd=changeset;node=5cd4346eed47
   656   details: http://test/b?cmd=changeset;node=5cd4346eed47
   624   description: default template
   657   description: default template
   645   Content-Transfer-Encoding: 7bit
   678   Content-Transfer-Encoding: 7bit
   646   Date: * (glob)
   679   Date: * (glob)
   647   Subject: with style
   680   Subject: with style
   648   From: test@test.com
   681   From: test@test.com
   649   X-Hg-Notification: changeset ec8d9d852f56
   682   X-Hg-Notification: changeset ec8d9d852f56
   650   Message-Id: <hg.ec8d9d852f56.*.*@*> (glob)
   683   Message-Id: <hg.ccd5049818a6a277251189ce1d6d0cca10723d58214199e7178894adb99ed918@test.com>
   651   To: baz@test.com, foo@bar
   684   To: baz@test.com, foo@bar
   652   
   685   
   653   changeset ec8d9d852f56
   686   changeset ec8d9d852f56
   654 
   687 
   655 with template (overrides style):
   688 with template (overrides style):
   670   Content-Transfer-Encoding: 7bit
   703   Content-Transfer-Encoding: 7bit
   671   Date: * (glob)
   704   Date: * (glob)
   672   Subject: 14721b538ae3: with template
   705   Subject: 14721b538ae3: with template
   673   From: test@test.com
   706   From: test@test.com
   674   X-Hg-Notification: changeset 14721b538ae3
   707   X-Hg-Notification: changeset 14721b538ae3
   675   Message-Id: <hg.14721b538ae3.*.*@*> (glob)
   708   Message-Id: <hg.7edb9765307a5a24528f3964672e794e2d21f2479e96c099bf52e02abd17b3a2@test.com>
   676   To: baz@test.com, foo@bar
   709   To: baz@test.com, foo@bar
   677   
   710   
   678   with template
   711   with template
   679 
   712 
   680 showfunc diff
   713 showfunc diff
   693   >     return a + b + c + d;
   726   >     return a + b + c + d;
   694   > }
   727   > }
   695   > EOF
   728   > EOF
   696   $ hg commit -Am addfunction
   729   $ hg commit -Am addfunction
   697   adding f1
   730   adding f1
       
   731   $ hg debugobsolete eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee b86bc16ff894f057d023b306936f290954857187
       
   732   1 new obsolescence markers
   698   $ hg --cwd ../b pull ../a | \
   733   $ hg --cwd ../b pull ../a | \
   699   >  "$PYTHON" $TESTDIR/unwrap-message-id.py
   734   >  "$PYTHON" $TESTDIR/unwrap-message-id.py
   700   pulling from ../a
   735   pulling from ../a
   701   searching for changes
   736   searching for changes
   702   adding changesets
   737   adding changesets
   703   adding manifests
   738   adding manifests
   704   adding file changes
   739   adding file changes
   705   added 1 changesets with 1 changes to 1 files
   740   added 1 changesets with 1 changes to 1 files
   706   new changesets b86bc16ff894
   741   1 new obsolescence markers
       
   742   new changesets b86bc16ff894 (1 drafts)
   707   MIME-Version: 1.0
   743   MIME-Version: 1.0
   708   Content-Type: text/plain; charset="us-ascii"
   744   Content-Type: text/plain; charset="us-ascii"
   709   Content-Transfer-Encoding: 7bit
   745   Content-Transfer-Encoding: 7bit
   710   Date: * (glob)
   746   Date: * (glob)
   711   Subject: addfunction
   747   Subject: addfunction
   712   From: test@test.com
   748   From: test@test.com
   713   X-Hg-Notification: changeset b86bc16ff894
   749   X-Hg-Notification: changeset b86bc16ff894
   714   Message-Id: <hg.b86bc16ff894.*.*@*> (glob)
   750   Message-Id: <hg.4c7cacfbbd6ba170656be0c8fc0d7599bd925c0d545b836816be9983e6d08448@test.com>
   715   To: baz@test.com, foo@bar
   751   To: baz@test.com, foo@bar
   716   
   752   
   717   changeset b86bc16ff894
   753   changeset b86bc16ff894
   718   diffs (11 lines):
   754   diffs (11 lines):
   719   
   755   
   737   >     int e = 3;
   773   >     int e = 3;
   738   >     return a + b + c + e;
   774   >     return a + b + c + e;
   739   > }
   775   > }
   740   > EOF
   776   > EOF
   741   $ hg commit -m changefunction
   777   $ hg commit -m changefunction
       
   778   $ hg debugobsolete 485bf79b9464197b2ed2debd0b16252ad64ed458 e81040e9838c704d8bf17658cb11758f24e40b6b
       
   779   1 new obsolescence markers
       
   780   obsoleted 1 changesets
   742   $ hg --cwd ../b --config notify.showfunc=True pull ../a | \
   781   $ hg --cwd ../b --config notify.showfunc=True pull ../a | \
   743   >  "$PYTHON" $TESTDIR/unwrap-message-id.py
   782   >  "$PYTHON" $TESTDIR/unwrap-message-id.py
   744   pulling from ../a
   783   pulling from ../a
   745   searching for changes
   784   searching for changes
   746   adding changesets
   785   adding changesets
   747   adding manifests
   786   adding manifests
   748   adding file changes
   787   adding file changes
   749   added 1 changesets with 1 changes to 1 files
   788   added 1 changesets with 1 changes to 1 files
   750   new changesets e81040e9838c
   789   1 new obsolescence markers
       
   790   obsoleted 1 changesets
       
   791   new changesets e81040e9838c (1 drafts)
   751   MIME-Version: 1.0
   792   MIME-Version: 1.0
   752   Content-Type: text/plain; charset="us-ascii"
   793   Content-Type: text/plain; charset="us-ascii"
   753   Content-Transfer-Encoding: 7bit
   794   Content-Transfer-Encoding: 7bit
   754   Date: * (glob)
   795   Date: * (glob)
   755   Subject: changefunction
   796   Subject: changefunction
   756   From: test@test.com
   797   From: test@test.com
   757   X-Hg-Notification: changeset e81040e9838c
   798   X-Hg-Notification: changeset e81040e9838c
   758   Message-Id: <hg.e81040e9838c.*.*@*> (glob)
   799   Message-Id: <hg.99b80bf1c5d0bf8f8a7e60107c1aa1da367a5943b2a70a8b36517d701557edff@test.com>
       
   800   In-Reply-To: <hg.15281d60c27d9d5fb70435d33ebc24cb5aa580f2535988dcb9923c26e8bc5c47@test.com>
   759   To: baz@test.com, foo@bar
   801   To: baz@test.com, foo@bar
   760   
   802   
   761   changeset e81040e9838c
   803   changeset e81040e9838c
   762   diffs (12 lines):
   804   diffs (12 lines):
   763   
   805   
   772   -    return a + b + c + d;
   814   -    return a + b + c + d;
   773   +    int e = 3;
   815   +    int e = 3;
   774   +    return a + b + c + e;
   816   +    return a + b + c + e;
   775    }
   817    }
   776   (run 'hg update' to get a working copy)
   818   (run 'hg update' to get a working copy)
       
   819 
       
   820 Retry the In-Reply-To, but make sure the oldest known change is older.
       
   821 This can happen when folding commits that have been rebased by another user.
       
   822 
       
   823   $ hg --cwd ../b strip tip
       
   824   saved backup bundle to $TESTTMP/b/.hg/strip-backup/e81040e9838c-10aad4de-backup.hg
       
   825   $ hg debugobsolete f7e5aaed408029cfe9890318245e87ef44739fdd e81040e9838c704d8bf17658cb11758f24e40b6b
       
   826   1 new obsolescence markers
       
   827   obsoleted 1 changesets
       
   828   $ hg --cwd ../b --config notify.showfunc=True pull ../a | \
       
   829   >  "$PYTHON" $TESTDIR/unwrap-message-id.py
       
   830   pulling from ../a
       
   831   searching for changes
       
   832   adding changesets
       
   833   adding manifests
       
   834   adding file changes
       
   835   added 1 changesets with 1 changes to 1 files
       
   836   2 new obsolescence markers
       
   837   obsoleted 2 changesets
       
   838   new changesets e81040e9838c (1 drafts)
       
   839   MIME-Version: 1.0
       
   840   Content-Type: text/plain; charset="us-ascii"
       
   841   Content-Transfer-Encoding: 7bit
       
   842   Date: * (glob)
       
   843   Subject: changefunction
       
   844   From: test@test.com
       
   845   X-Hg-Notification: changeset e81040e9838c
       
   846   Message-Id: <hg.99b80bf1c5d0bf8f8a7e60107c1aa1da367a5943b2a70a8b36517d701557edff@test.com>
       
   847   In-Reply-To: <hg.12e9ae631e2529e9cfbe7a93be0dd8a401280700640f802a60f20d7be659251d@test.com>
       
   848   To: baz@test.com, foo@bar
       
   849   
       
   850   changeset e81040e9838c
       
   851   diffs (12 lines):
       
   852   
       
   853   diff -r b86bc16ff894 -r e81040e9838c f1
       
   854   --- a/f1	Thu Jan 01 00:00:00 1970 +0000
       
   855   +++ b/f1	Thu Jan 01 00:00:00 1970 +0000
       
   856   @@ -2,6 +2,6 @@ int main() {
       
   857        int a = 0;
       
   858        int b = 1;
       
   859        int c = 2;
       
   860   -    int d = 3;
       
   861   -    return a + b + c + d;
       
   862   +    int e = 3;
       
   863   +    return a + b + c + e;
       
   864    }
       
   865   (run 'hg update' to get a working copy)