releasenotes: allow notes for multiple directives in a single changeset
authorRishabh Madan <rishabhmadan96@gmail.com>
Sun, 04 Mar 2018 00:25:58 +0530
changeset 36770 a5891e94bfe1
parent 36769 3fff6f30bd7f
child 36771 f7e3fe95b663
releasenotes: allow notes for multiple directives in a single changeset This problem was caught in da91e7309daf8ffc51bf3e6f4b2d8a16ef5af95a. This patch just makes sure there is no warning when we encounter such a case. Differential Revision: https://phab.mercurial-scm.org/D2254
hgext/releasenotes.py
tests/test-releasenotes-formatting.t
--- a/hgext/releasenotes.py	Sun Mar 04 00:15:35 2018 +0530
+++ b/hgext/releasenotes.py	Sun Mar 04 00:25:58 2018 +0530
@@ -324,6 +324,9 @@
                 if pblock['type'] == 'margin':
                     continue
 
+                if pblock['type'] == 'admonition':
+                    break
+
                 if pblock['type'] != 'paragraph':
                     repo.ui.warn(_('changeset %s: unexpected block in release '
                         'notes directive %s\n') % (ctx, directive))
--- a/tests/test-releasenotes-formatting.t	Sun Mar 04 00:15:35 2018 +0530
+++ b/tests/test-releasenotes-formatting.t	Sun Mar 04 00:25:58 2018 +0530
@@ -457,3 +457,35 @@
   ------------------
   
   First paragraph of fix 1.
+
+  $ cd ..
+
+Using multiple admonitions in same changeset
+
+  $ hg init relnotes-multiadmon
+  $ cd relnotes-multiadmon
+
+  $ touch file1
+  $ hg -q commit -A -l - << EOF
+  > commit 1
+  > 
+  > .. feature::
+  > 
+  >    Details about new feature.
+  > 
+  > .. perf::
+  > 
+  >    Improves the execution by 2x
+  > EOF
+
+  $ hg releasenotes -r . $TESTTMP/relnotes-multiple-admonitions
+  $ cat $TESTTMP/relnotes-multiple-admonitions
+  New Features
+  ============
+  
+  * Details about new feature.
+  
+  Performance Improvements
+  ========================
+  
+  * Improves the execution by 2x