Patchwork D2255: releasenotes: replace abort with warning while parsing (issue5775)

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 7:17 p.m.
Message ID <69b54d021ee0971504b308e4d5a23e4e@localhost.localdomain>
Download mbox | patch
Permalink /patch/28967/
State Not Applicable
Headers show

Comments

phabricator - March 4, 2018, 7:17 p.m.
rishabhmadan96 updated this revision to Diff 6590.
rishabhmadan96 edited the summary of this revision.
rishabhmadan96 retitled this revision from "releasenotes: replace abort with warning while parsing" to "releasenotes: replace abort with warning while parsing (issue5775)".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2255?vs=5695&id=6590

REVISION DETAIL
  https://phab.mercurial-scm.org/D2255

AFFECTED FILES
  hgext/releasenotes.py
  tests/test-releasenotes-parsing.t

CHANGE DETAILS




To: rishabhmadan96, #hg-reviewers
Cc: durin42, pulkit, mercurial-devel

Patch

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 @@ 
       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 ..
diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -325,8 +325,8 @@ 
                     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'])