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

Rishabh Madan rishabhmadan96 at gmail.com
Mon Jul 3 09:32:30 EDT 2017


On Mon, Jul 3, 2017 at 3:17 PM, Yuya Nishihara <yuya at tcha.org> wrote:

> On Sat, 1 Jul 2017 00:10:50 +0530, Pulkit Goyal 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.
>
> Maybe this isn't a per-user thing, but tied with a repository (like .hgtag
> or .hgeol) ?
>

Yeah you're right. This is something limited to the repository.
All the users contributing to it will probably need to have a common
understanding about the custom sections to be used in notes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170703/68e4630a/attachment.html>


More information about the Mercurial-devel mailing list