diff tests/test-releasenotes-formatting.t @ 33571:9a944e908ecf

releasenotes: add custom admonitions support for release notes By default, the extension has default sections like fix, feature, perf etc.. This patch allow user to add support for custom admonition. In order to add a custom admonition, one needs to have a .hgreleasenotes file inside the repository. All the custom directive with name specified under the tag [sections] will be usable by the extension. One important thing to keep in mind is if there exists any custom admonitions with same key as default then they will override the default ones.
author Rishabh Madan <rishabhmadan96@gmail.com>
date Tue, 18 Jul 2017 23:04:08 +0530
parents 2510823ca0df
children 3748098d072a
line wrap: on
line diff
--- a/tests/test-releasenotes-formatting.t	Tue Jul 18 06:27:36 2017 -0700
+++ b/tests/test-releasenotes-formatting.t	Tue Jul 18 23:04:08 2017 +0530
@@ -255,6 +255,8 @@
   
   * Short summary of fix 3
 
+  $ cd ..
+
 Multiple 'Other Changes' sub-sections for every section
 
   $ hg init multiple-otherchanges
@@ -324,3 +326,53 @@
   
   * Short summary of fix 2
 
+  $ cd ..
+
+Using custom sections in notes
+
+  $ hg init custom-section
+  $ cd custom-section
+  $ cat >> .hgreleasenotes << EOF
+  > [sections]
+  > testsection=Name of Section
+  > EOF
+
+  $ touch a
+  $ hg -q commit -A -l - << EOF
+  > commit 1
+  > 
+  > .. testsection::
+  > 
+  >    First paragraph under this admonition.
+  > EOF
+
+  $ hg releasenotes -r . $TESTTMP/relnotes-custom-section
+  $ cat $TESTTMP/relnotes-custom-section
+  Name of Section
+  ===============
+  
+  * First paragraph under this admonition.
+
+Overriding default sections (For eg. by default feature = New Features)
+
+  $ cat >> .hgreleasenotes << EOF
+  > [sections]
+  > feature=Feature Additions
+  > EOF
+
+  $ touch b
+  $ hg -q commit -A -l - << EOF
+  > commit 2
+  > 
+  > .. feature::
+  > 
+  >    Adds a new feature.
+  > EOF
+
+  $ hg releasenotes -r . $TESTTMP/relnotes-override-section
+  $ cat $TESTTMP/relnotes-override-section
+  Feature Additions
+  =================
+  
+  * Adds a new feature.
+