[PATCH 2 of 2] releasenotes: add custom admonitions support for release notes

Rishabh Madan rishabhmadan96 at gmail.com
Sat Jul 1 09:24:25 UTC 2017


On Fri, Jun 30, 2017 at 8:40 PM, Pulkit Goyal <7895pulkit at gmail.com> wrote:

> On Fri, Jun 30, 2017 at 4:27 AM, Rishabh Madan <rishabhmadan96 at gmail.com>
> wrote:
> > # HG changeset patch
> > # User Rishabh Madan <rishabhmadan96 at gmail.com>
> > # Date 1498776526 -7200
> > #      Fri Jun 30 00:48:46 2017 +0200
> > # Node ID 9674e42ec8aac0f4f0d237c6270b38ace21d5d52
> > # Parent  9f7c675413ffce1497c7db3ff1495e4050b151d6
> > 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 add a [customsections] config to .hgrc file.
> All the
> > custom directive with name specified under this tag will be usable by
> the extension.
> >
> > diff -r 9f7c675413ff -r 9674e42ec8aa hgext/releasenotes.py
> > --- a/hgext/releasenotes.py     Thu Jun 29 23:30:03 2017 +0200
> > +++ b/hgext/releasenotes.py     Fri Jun 30 00:48:46 2017 +0200
> > @@ -112,8 +112,12 @@
> >
> >  class releasenotessections(object):
> >      def __init__(self, ui):
> > -        # TODO support defining custom sections from config.
> > -        self._sections = list(DEFAULT_SECTIONS)
> > +        self.ui = ui
> > +        CUSTOM_SECTIONS = ui.configitems('customsections')
> > +        if CUSTOM_SECTIONS:
> > +            self._sections = list(DEFAULT_SECTIONS) +
> list(CUSTOM_SECTIONS)
> > +        else:
> > +            self._sections = list(DEFAULT_SECTIONS)
> >
> >      def __iter__(self):
> >          return iter(self._sections)
> > diff -r 9f7c675413ff -r 9674e42ec8aa tests/test-releasenotes-
> formatting.t
> > --- a/tests/test-releasenotes-formatting.t      Thu Jun 29 23:30:03
> 2017 +0200
> > +++ b/tests/test-releasenotes-formatting.t      Fri Jun 30 00:48:46
> 2017 +0200
> > @@ -324,3 +324,30 @@
> >
> >    * Short summary of fix 2
> >
> > +Using custom admonition in notes
> > +
> > +  $ cat >> $HGRCPATH << EOF
> > +  > [extensions]
> > +  > releasenotes=
> > +  >
> > +  > [customsections]
> > +  > testsection=Name of Section
> > +  > EOF
>
> Can we name this more extension specific like [releasenotes.sections]
> or something similar. Also the custom sections should override default
> sections. For example, someone might like to expand api to be
> something different or bc to something different.


Yes I think that would be a better name. About the overriding thing, I'll
make the suggested changes. I guess that would make it more robust.

>
>
Also, maybe we can support regexes in custom sections part. That's
> just an idea and I am not sure if that will be much useful.
>

Can you please elaborate this part a bit? I didn't quite get it.
ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170701/61e997bb/attachment.html>


More information about the Mercurial-devel mailing list