# HG changeset patch # User Rishabh Madan # Date 2018-03-03 18:17:22 # Node ID 658ed9c7442b791b8584e6b0683a4489aef0bec7 # Parent a148c67d8b09785165b254c3c66a21de15a8d284 releasenotes: replace abort with warning while parsing (issue5775) During the 4.5 development cycle, the extension broke on two different changesets. This fixes the issue by ensuring that it just throws a warning when it encounters unexpected behaviour, instead of aborting. Differential Revision: https://phab.mercurial-scm.org/D2255 diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -325,8 +325,8 @@ def parsenotesfromrevisions(repo, direct continue if pblock['type'] != 'paragraph': - raise error.Abort(_('unexpected block in release notes ' - 'directive %s') % directive) + repo.ui.warn(_('unexpected block in release notes ' + 'directive %s\n') % directive) if pblock['indent'] > 0: paragraphs.append(pblock['lines']) diff --git a/tests/test-releasenotes-parsing.t b/tests/test-releasenotes-parsing.t --- a/tests/test-releasenotes-parsing.t +++ b/tests/test-releasenotes-parsing.t @@ -177,3 +177,26 @@ Mixed sub-sections and bullet list paragraph: Bullet item 1 bullet point: paragraph: Bullet item 2 + +Warn user in case of unexpected block while parsing + + $ hg init relnotes-warn + $ cd relnotes-warn + $ touch feature1 + $ hg -q commit -A -l - << EOF + > commit 1 + > + > .. feature:: + > + > new feature added. + > some words about the feature. + > EOF + + $ hg releasenote -r . + unexpected block in release notes directive feature + New Features + ============ + + * new feature added. some words about the feature. + + $ cd ..