Patchwork D877: releasenotes: display release notes when no filename is specified

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2017, 1:48 p.m.
Message ID <b284ece4208d5c88d129a9ae38e524fc@localhost.localdomain>
Download mbox | patch
Permalink /patch/24352/
State Not Applicable
Headers show

Comments

phabricator - Oct. 1, 2017, 1:48 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG159a6f7e09a9: releasenotes: display release notes when no filename is specified (authored by rishabhmadan96, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D877?vs=2263&id=2289#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D877?vs=2263&id=2289

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

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

CHANGE DETAILS




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

Patch

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
@@ -434,3 +434,26 @@ 
   $ hg releasenotes -l -c
   abort: cannot use both '--list' and '--check'
   [255]
+
+Display release notes for specified revs if no file is mentioned
+
+  $ hg init relnotes-nofile
+  $ cd relnotes-nofile
+
+  $ touch fix1
+  $ hg -q commit -A -l - << EOF
+  > commit 1
+  > 
+  > .. fix:: Title of First Fix
+  > 
+  >    First paragraph of fix 1.
+  > EOF
+
+  $ hg releasenote -r .
+  Bug Fixes
+  =========
+  
+  Title of First Fix
+  ------------------
+  
+  First paragraph of fix 1.
diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -576,6 +576,9 @@ 
 
     incoming = parsenotesfromrevisions(repo, sections.names(), revs)
 
+    if file_ is None:
+        return ui.write(serializenotes(sections, incoming))
+
     try:
         with open(file_, 'rb') as fh:
             notes = parsereleasenotesfile(sections, fh.read())