Mercurial > hg
comparison tests/test-releasenotes-parsing.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 | 5814db57941c |
comparison
equal
deleted
inserted
replaced
32777:9dccaff02ad5 | 32778:91e355a0408b |
---|---|
1 $ cat >> $HGRCPATH << EOF | |
2 > [extensions] | |
3 > releasenotes= | |
4 > EOF | |
5 | |
6 Bullet point with a single item spanning a single line | |
7 | |
8 $ hg debugparsereleasenotes - << EOF | |
9 > New Features | |
10 > ============ | |
11 > | |
12 > * Bullet point item with a single line | |
13 > EOF | |
14 section: feature | |
15 bullet point: | |
16 paragraph: Bullet point item with a single line | |
17 | |
18 Bullet point that spans multiple lines. | |
19 | |
20 $ hg debugparsereleasenotes - << EOF | |
21 > New Features | |
22 > ============ | |
23 > | |
24 > * Bullet point with a paragraph | |
25 > that spans multiple lines. | |
26 > EOF | |
27 section: feature | |
28 bullet point: | |
29 paragraph: Bullet point with a paragraph that spans multiple lines. | |
30 | |
31 $ hg debugparsereleasenotes - << EOF | |
32 > New Features | |
33 > ============ | |
34 > | |
35 > * Bullet point with a paragraph | |
36 > that spans multiple lines. | |
37 > | |
38 > And has an empty line between lines too. | |
39 > With a line cuddling that. | |
40 > EOF | |
41 section: feature | |
42 bullet point: | |
43 paragraph: Bullet point with a paragraph that spans multiple lines. | |
44 paragraph: And has an empty line between lines too. With a line cuddling that. | |
45 | |
46 Multiple bullet points. With some entries being multiple lines. | |
47 | |
48 $ hg debugparsereleasenotes - << EOF | |
49 > New Features | |
50 > ============ | |
51 > | |
52 > * First bullet point. It has a single line. | |
53 > | |
54 > * Second bullet point. | |
55 > It consists of multiple lines. | |
56 > | |
57 > * Third bullet point. It has a single line. | |
58 > EOF | |
59 section: feature | |
60 bullet point: | |
61 paragraph: First bullet point. It has a single line. | |
62 paragraph: Second bullet point. It consists of multiple lines. | |
63 paragraph: Third bullet point. It has a single line. | |
64 | |
65 Bullet point without newline between items | |
66 | |
67 $ hg debugparsereleasenotes - << EOF | |
68 > New Features | |
69 > ============ | |
70 > | |
71 > * First bullet point | |
72 > * Second bullet point | |
73 > And it has multiple lines | |
74 > * Third bullet point | |
75 > * Fourth bullet point | |
76 > EOF | |
77 section: feature | |
78 bullet point: | |
79 paragraph: First bullet point | |
80 paragraph: Second bullet point And it has multiple lines | |
81 paragraph: Third bullet point | |
82 paragraph: Fourth bullet point | |
83 | |
84 Sub-section contents are read | |
85 | |
86 $ hg debugparsereleasenotes - << EOF | |
87 > New Features | |
88 > ============ | |
89 > | |
90 > First Feature | |
91 > ------------- | |
92 > | |
93 > This is the first new feature that was implemented. | |
94 > | |
95 > And a second paragraph about it. | |
96 > | |
97 > Second Feature | |
98 > -------------- | |
99 > | |
100 > This is the second new feature that was implemented. | |
101 > | |
102 > Paragraph two. | |
103 > | |
104 > Paragraph three. | |
105 > EOF | |
106 section: feature | |
107 subsection: First Feature | |
108 paragraph: This is the first new feature that was implemented. | |
109 paragraph: And a second paragraph about it. | |
110 subsection: Second Feature | |
111 paragraph: This is the second new feature that was implemented. | |
112 paragraph: Paragraph two. | |
113 paragraph: Paragraph three. | |
114 | |
115 Multiple sections are read | |
116 | |
117 $ hg debugparsereleasenotes - << EOF | |
118 > New Features | |
119 > ============ | |
120 > | |
121 > * Feature 1 | |
122 > * Feature 2 | |
123 > | |
124 > Bug Fixes | |
125 > ========= | |
126 > | |
127 > * Fix 1 | |
128 > * Fix 2 | |
129 > EOF | |
130 section: feature | |
131 bullet point: | |
132 paragraph: Feature 1 | |
133 paragraph: Feature 2 | |
134 section: fix | |
135 bullet point: | |
136 paragraph: Fix 1 | |
137 paragraph: Fix 2 | |
138 | |
139 Mixed sub-sections and bullet list | |
140 | |
141 $ hg debugparsereleasenotes - << EOF | |
142 > New Features | |
143 > ============ | |
144 > | |
145 > Feature 1 | |
146 > --------- | |
147 > | |
148 > Some words about the first feature. | |
149 > | |
150 > Feature 2 | |
151 > --------- | |
152 > | |
153 > Some words about the second feature. | |
154 > That span multiple lines. | |
155 > | |
156 > Other Changes | |
157 > ------------- | |
158 > | |
159 > * Bullet item 1 | |
160 > * Bullet item 2 | |
161 > EOF | |
162 section: feature | |
163 subsection: Feature 1 | |
164 paragraph: Some words about the first feature. | |
165 subsection: Feature 2 | |
166 paragraph: Some words about the second feature. That span multiple lines. | |
167 bullet point: | |
168 paragraph: Bullet item 1 | |
169 paragraph: Bullet item 2 |