comparison tests/test-releasenotes-merging.t @ 32778:91e355a0408b

releasenotes: command to manage release notes files Per discussion on the mailing list, we want better release notes for Mercurial. This patch introduces an extension that provides a command for producing release notes files. Functionality is implemented as an extension because it could be useful outside of the Mercurial project and because there is some code (like rst parsing) that already exists in Mercurial and it doesn't make sense to reinvent the wheel. The general idea with the extension is that changeset authors declare release notes in commit messages using rst directives. Periodically (such as at publishing or release time), a project maintainer runs `hg releasenotes` to extract release notes fragments from commit messages and format them to an auto-generated release notes file. More details are explained inline in docstrings. There are several things that need addressed before this is ready for prime time: * Moar tests * Interactive merge mode * Implement similarity detection for individual notes items * Support customizing section names/titles * Parsing improvements for bullet lists and paragraphs * Document which rst primitives can be parsed * Retain arbitrary content (e.g. header section/paragraphs) from existing release notes file * Better error messages (line numbers, hints, etc)
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 02 Jun 2017 23:33:30 +0200
parents
children 2510823ca0df
comparison
equal deleted inserted replaced
32777:9dccaff02ad5 32778:91e355a0408b
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
3 > releasenotes=
4 > EOF
5
6 $ hg init simple-repo
7 $ cd simple-repo
8
9 A fix directive from commit message is added to release notes
10
11 $ touch fix1
12 $ hg -q commit -A -l - << EOF
13 > commit 1
14 >
15 > .. fix::
16 >
17 > Fix from commit message.
18 > EOF
19
20 $ cat >> $TESTTMP/single-fix-bullet << EOF
21 > Bug Fixes
22 > =========
23 >
24 > * Fix from release notes.
25 > EOF
26
27 $ hg releasenotes -r . $TESTTMP/single-fix-bullet
28
29 $ cat $TESTTMP/single-fix-bullet
30 Bug Fixes
31 =========
32
33 * Fix from release notes.
34
35 * Fix from commit message.
36
37 Processing again will no-op
38 TODO this is buggy
39
40 $ hg releasenotes -r . $TESTTMP/single-fix-bullet
41
42 $ cat $TESTTMP/single-fix-bullet
43 Bug Fixes
44 =========
45
46 * Fix from release notes.
47
48 Fix from commit message.
49
50 * Fix from commit message.
51
52 $ cd ..
53
54 Sections are unioned
55
56 $ hg init subsections
57 $ cd subsections
58 $ touch fix1
59 $ hg -q commit -A -l - << EOF
60 > Commit 1
61 >
62 > .. feature:: Commit Message Feature
63 >
64 > This describes a feature from a commit message.
65 > EOF
66
67 $ cat >> $TESTTMP/single-feature-section << EOF
68 > New Features
69 > ============
70 >
71 > Notes Feature
72 > -------------
73 >
74 > This describes a feature from a release notes file.
75 > EOF
76
77 $ hg releasenotes -r . $TESTTMP/single-feature-section
78
79 $ cat $TESTTMP/single-feature-section
80 New Features
81 ============
82
83 Notes Feature
84 -------------
85
86 This describes a feature from a release notes file.
87
88 Commit Message Feature
89 ----------------------
90
91 This describes a feature from a commit message.
92
93 Doing it again won't add another section
94
95 $ hg releasenotes -r . $TESTTMP/single-feature-section
96 Commit Message Feature already exists in feature section; ignoring
97
98 $ cat $TESTTMP/single-feature-section
99 New Features
100 ============
101
102 Notes Feature
103 -------------
104
105 This describes a feature from a release notes file.
106
107 Commit Message Feature
108 ----------------------
109
110 This describes a feature from a commit message.
111
112 $ cd ..