D454: releasenotes: view admonition titles using -l flag
rishabhmadan96 (Rishabh Madan)
phabricator at mercurial-scm.org
Mon Aug 21 09:12:00 EDT 2017
rishabhmadan96 updated this revision to Diff 1123.
rishabhmadan96 edited the summary of this revision.
rishabhmadan96 retitled this revision from "releasenotes: view admonition titles using -a flag" to "releasenotes: view admonition titles using -l flag".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D454?vs=1106&id=1123
REVISION DETAIL
https://phab.mercurial-scm.org/D454
AFFECTED FILES
hgext/releasenotes.py
tests/test-releasenotes-formatting.t
CHANGE DETAILS
diff --git a/tests/test-releasenotes-formatting.t b/tests/test-releasenotes-formatting.t
--- a/tests/test-releasenotes-formatting.t
+++ b/tests/test-releasenotes-formatting.t
@@ -378,3 +378,15 @@
* Adds a new feature.
+ $ cd ..
+
+Usage of --list flag
+
+ $ hg init relnotes-list
+ $ cd relnotes-list
+ $ hg releasenotes -l
+ feature: New Features
+ bc: Backwards Compatibility Changes
+ fix: Bug Fixes
+ perf: Performance Improvements
+ api: API Changes
diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -242,6 +242,10 @@
read('.hgreleasenotes')
return p['sections']
+def _getadmonitionlist(ui, sections):
+ for section in sections._sections:
+ ui.write(_(str(section[0]) + ": " + section[1] + "\n"))
+
def parsenotesfromrevisions(repo, directives, revs):
notes = parsedreleasenotes()
@@ -432,9 +436,11 @@
return '\n'.join(lines)
@command('releasenotes',
- [('r', 'rev', '', _('revisions to process for release notes'), _('REV'))],
- _('[-r REV] FILE'))
-def releasenotes(ui, repo, file_, rev=None):
+ [('r', 'rev', '', _('revisions to process for release notes'), _('REV')),
+ ('l', 'list', False, _('list the available admonitions with their title'),
+ None)],
+ _('hg releasenotes [-r REV] FILE'))
+def releasenotes(ui, repo, file_=None, **opts):
"""parse release notes from commit messages into an output file
Given an output file and set of revisions, this command will parse commit
@@ -511,6 +517,10 @@
release note after it has been added to the release notes file.
"""
sections = releasenotessections(ui, repo)
+ if opts.get('list'):
+ return _getadmonitionlist(ui, sections)
+
+ rev = opts.get('rev')
revs = scmutil.revrange(repo, [rev or 'not public()'])
incoming = parsenotesfromrevisions(repo, sections.names(), revs)
To: rishabhmadan96, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
More information about the Mercurial-devel
mailing list