D877: releasenotes: display release notes when no filename is specified
rishabhmadan96 (Rishabh Madan)
phabricator at mercurial-scm.org
Sun Oct 1 12:46:09 UTC 2017
rishabhmadan96 updated this revision to Diff 2263.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D877?vs=2261&id=2263
REVISION DETAIL
https://phab.mercurial-scm.org/D877
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
@@ -435,42 +435,25 @@
abort: cannot use both '--list' and '--check'
[255]
-Raise error when no filename is specified with --rev
+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 .
- ** unknown exception encountered, please report by visiting
- ** https://mercurial-scm.org/wiki/BugTracker
- ** Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
- ** Mercurial Distributed SCM (version 4.3.3+701-c4594d38b2da+20171001)
- ** Extensions loaded: releasenotes
- Traceback (most recent call last):
- File "/tmp/hgtests.5N93rp/install/bin/hg", line 47, in <module>
- dispatch.run()
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 81, in run
- status = (dispatch(req) or 0) & 255
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 163, in dispatch
- ret = _runcatch(req)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 303, in _runcatch
- return _callcatch(ui, _runcatchfunc)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 311, in _callcatch
- return scmutil.callcatch(ui, func)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/scmutil.py", line 151, in callcatch
- return func()
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 293, in _runcatchfunc
- return _dispatch(req)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 929, in _dispatch
- cmdpats, cmdoptions)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 691, in runcommand
- ret = _runcommand(ui, options, cmd, d)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 937, in _runcommand
- return cmdfunc()
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/dispatch.py", line 926, in <lambda>
- d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
- File "/tmp/hgtests.5N93rp/install/lib/python/mercurial/util.py", line 1180, in check
- return func(*args, **kwargs)
- File "/tmp/hgtests.5N93rp/install/lib/python/hgext/releasenotes.py", line 580, in releasenotes
- with open(file_, 'rb') as fh:
- TypeError: coercing to Unicode: need string or buffer, NoneType found
- [1]
+ 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())
To: rishabhmadan96, #hg-reviewers
Cc: pulkit, mercurial-devel
More information about the Mercurial-devel
mailing list