Debian Codegraph @

tests/test-releasenotes-formatting.t

raw
1 #require fuzzywuzzy
2
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
5 > releasenotes=
6 > EOF
7
8 $ hg init simple-repo
9 $ cd simple-repo
10
11 A fix with a single line results in a bullet point in the appropriate section
12
13 $ touch fix1
14 $ hg -q commit -A -l - << EOF
15 > single line fix
16 >
17 > .. fix::
18 >
19 > Simple fix with a single line content entry.
20 > EOF
21
22 $ hg releasenotes -r . $TESTTMP/relnotes-single-line
23
24 $ cat $TESTTMP/relnotes-single-line
25 Bug Fixes
26 =========
27
28 * Simple fix with a single line content entry.
29
30 A fix with multiple lines is handled correctly
31
32 $ touch fix2
33 $ hg -q commit -A -l - << EOF
34 > multi line fix
35 >
36 > .. fix::
37 >
38 > First line of fix entry.
39 > A line after it without a space.
40 >
41 > A new paragraph in the fix entry. And this is a really long line. It goes on for a while.
42 > And it wraps around to a new paragraph.
43 > EOF
44
45 $ hg releasenotes -r . $TESTTMP/relnotes-multi-line
46 $ cat $TESTTMP/relnotes-multi-line
47 Bug Fixes
48 =========
49
50 * First line of fix entry. A line after it without a space.
51
52 A new paragraph in the fix entry. And this is a really long line. It goes on
53 for a while. And it wraps around to a new paragraph.
54
55 A release note with a title results in a sub-section being written
56
57 $ touch fix3
58 $ hg -q commit -A -l - << EOF
59 > fix with title
60 >
61 > .. fix:: Fix Title
62 >
63 > First line of fix with title.
64 >
65 > Another paragraph of fix with title. But this is a paragraph
66 > with multiple lines.
67 > EOF
68
69 $ hg releasenotes -r . $TESTTMP/relnotes-fix-with-title
70 $ cat $TESTTMP/relnotes-fix-with-title
71 Bug Fixes
72 =========
73
74 Fix Title
75 ---------
76
77 First line of fix with title.
78
79 Another paragraph of fix with title. But this is a paragraph with multiple
80 lines.
81
82 $ cd ..
83
84 Formatting of multiple bullet points works
85
86 $ hg init multiple-bullets
87 $ cd multiple-bullets
88 $ touch fix1
89 $ hg -q commit -A -l - << EOF
90 > commit 1
91 >
92 > .. fix::
93 >
94 > first fix
95 > EOF
96
97 $ touch fix2
98 $ hg -q commit -A -l - << EOF
99 > commit 2
100 >
101 > .. fix::
102 >
103 > second fix
104 >
105 > Second paragraph of second fix.
106 > EOF
107
108 $ touch fix3
109 $ hg -q commit -A -l - << EOF
110 > commit 3
111 >
112 > .. fix::
113 >
114 > third fix
115 > EOF
116
117 $ hg releasenotes -r 'all()' $TESTTMP/relnotes-multiple-bullets
118 $ cat $TESTTMP/relnotes-multiple-bullets
119 Bug Fixes
120 =========
121
122 * first fix
123
124 * second fix
125
126 Second paragraph of second fix.
127
128 * third fix
129
130 $ cd ..
131
132 Formatting of multiple sections works
133
134 $ hg init multiple-sections
135 $ cd multiple-sections
136 $ touch fix1
137 $ hg -q commit -A -l - << EOF
138 > commit 1
139 >
140 > .. fix::
141 >
142 > first fix
143 > EOF
144
145 $ touch feature1
146 $ hg -q commit -A -l - << EOF
147 > commit 2
148 >
149 > .. feature::
150 >
151 > description of the new feature
152 > EOF
153
154 $ touch fix2
155 $ hg -q commit -A -l - << EOF
156 > commit 3
157 >
158 > .. fix::
159 >
160 > second fix
161 > EOF
162
163 $ hg releasenotes -r 'all()' $TESTTMP/relnotes-multiple-sections
164 $ cat $TESTTMP/relnotes-multiple-sections
165 New Features
166 ============
167
168 * description of the new feature
169
170 Bug Fixes
171 =========
172
173 * first fix
174
175 * second fix
176
177 $ cd ..
178
179 Section with subsections and bullets
180
181 $ hg init multiple-subsections
182 $ cd multiple-subsections
183
184 $ touch fix1
185 $ hg -q commit -A -l - << EOF
186 > commit 1
187 >
188 > .. fix:: Title of First Fix
189 >
190 > First paragraph of first fix.
191 >
192 > Second paragraph of first fix.
193 > EOF
194
195 $ touch fix2
196 $ hg -q commit -A -l - << EOF
197 > commit 2
198 >
199 > .. fix:: Title of Second Fix
200 >
201 > First paragraph of second fix.
202 >
203 > Second paragraph of second fix.
204 > EOF
205
206 $ hg releasenotes -r 'all()' $TESTTMP/relnotes-multiple-subsections
207 $ cat $TESTTMP/relnotes-multiple-subsections
208 Bug Fixes
209 =========
210
211 Title of First Fix
212 ------------------
213
214 First paragraph of first fix.
215
216 Second paragraph of first fix.
217
218 Title of Second Fix
219 -------------------
220
221 First paragraph of second fix.
222
223 Second paragraph of second fix.
224
225 Now add bullet points to sections having sub-sections
226
227 $ touch fix3
228 $ hg -q commit -A -l - << EOF
229 > commit 3
230 >
231 > .. fix::
232 >
233 > Short summary of fix 3
234 > EOF
235
236 $ hg releasenotes -r 'all()' $TESTTMP/relnotes-multiple-subsections-with-bullets
237 $ cat $TESTTMP/relnotes-multiple-subsections-with-bullets
238 Bug Fixes
239 =========
240
241 Title of First Fix
242 ------------------
243
244 First paragraph of first fix.
245
246 Second paragraph of first fix.
247
248 Title of Second Fix
249 -------------------
250
251 First paragraph of second fix.
252
253 Second paragraph of second fix.
254
255 Other Changes
256 -------------
257
258 * Short summary of fix 3
259
260 $ cd ..
261
262 Multiple 'Other Changes' sub-sections for every section
263
264 $ hg init multiple-otherchanges
265 $ cd multiple-otherchanges
266
267 $ touch fix1
268 $ hg -q commit -A -l - << EOF
269 > commit 1
270 >
271 > .. fix:: Title of First Fix
272 >
273 > First paragraph of fix 1.
274 > EOF
275
276 $ touch feature1
277 $ hg -q commit -A -l - << EOF
278 > commit 2
279 >
280 > .. feature:: Title of First Feature
281 >
282 > First paragraph of feature 1.
283 > EOF
284
285 $ touch feature2
286 $ hg -q commit -A -l - << EOF
287 > commit 3
288 >
289 > .. feature::
290 >
291 > Short summary of feature 2.
292 > EOF
293
294 $ touch fix2
295 $ hg -q commit -A -l - << EOF
296 > commit 4
297 >
298 > .. fix::
299 >
300 > Short summary of fix 2
301 > EOF
302
303 $ hg releasenotes -r 'all()' $TESTTMP/relnotes-multiple-otherchanges
304 $ cat $TESTTMP/relnotes-multiple-otherchanges
305 New Features
306 ============
307
308 Title of First Feature
309 ----------------------
310
311 First paragraph of feature 1.
312
313 Other Changes
314 -------------
315
316 * Short summary of feature 2.
317
318 Bug Fixes
319 =========
320
321 Title of First Fix
322 ------------------
323
324 First paragraph of fix 1.
325
326 Other Changes
327 -------------
328
329 * Short summary of fix 2
330
331 $ cd ..
332
333 Using custom sections in notes
334
335 $ hg init custom-section
336 $ cd custom-section
337 $ cat >> .hgreleasenotes << EOF
338 > [sections]
339 > testsection=Name of Section
340 > EOF
341
342 $ touch a
343 $ hg -q commit -A -l - << EOF
344 > commit 1
345 >
346 > .. testsection::
347 >
348 > First paragraph under this admonition.
349 > EOF
350
351 $ hg releasenotes -r . $TESTTMP/relnotes-custom-section
352 $ cat $TESTTMP/relnotes-custom-section
353 Name of Section
354 ===============
355
356 * First paragraph under this admonition.
357
358 Overriding default sections (For eg. by default feature = New Features)
359
360 $ cat >> .hgreleasenotes << EOF
361 > [sections]
362 > feature=Feature Additions
363 > EOF
364
365 $ touch b
366 $ hg -q commit -A -l - << EOF
367 > commit 2
368 >
369 > .. feature::
370 >
371 > Adds a new feature.
372 > EOF
373
374 $ hg releasenotes -r . $TESTTMP/relnotes-override-section
375 $ cat $TESTTMP/relnotes-override-section
376 Feature Additions
377 =================
378
379 * Adds a new feature.
380
381 $ cd ..
382
383 Testing output for the --check (-c) flag
384
385 $ hg init check-flag
386 $ cd check-flag
387
388 $ touch a
389 $ hg -q commit -A -l - << EOF
390 > commit 2
391 >
392 > .. asf::
393 >
394 > First paragraph under this admonition.
395 > EOF
396
397 Suggest similar admonition in place of the invalid one.
398
399 $ hg releasenotes -r . -c
400 Invalid admonition 'asf' present in changeset 99fa3c800c5e
401
402 $ touch b
403 $ hg -q commit -A -l - << EOF
404 > .. fixes::
405 >
406 > First paragraph under this admonition.
407 > EOF
408
409 $ hg releasenotes -r . -c
410 Invalid admonition 'fixes' present in changeset 4737b1b5afd1
411 (did you mean fix?)
412
413 $ cd ..
414
415 Usage of --list flag
416
417 $ hg init relnotes-list
418 $ cd relnotes-list
419 $ hg releasenotes -l
420 feature: New Features
421 bc: Backwards Compatibility Changes
422 fix: Bug Fixes
423 perf: Performance Improvements
424 api: API Changes
425
426 $ cd ..
427
428 Raise error on simultaneous usage of flags
429
430 $ hg init relnotes-raise-error
431 $ cd relnotes-raise-error
432 $ hg releasenotes -r . -l
433 abort: cannot specify both --list and --rev
434 [10]
435
436 $ hg releasenotes -l -c
437 abort: cannot specify both --list and --check
438 [10]
439
440 Display release notes for specified revs if no file is mentioned
441
442 $ hg init relnotes-nofile
443 $ cd relnotes-nofile
444
445 $ touch fix1
446 $ hg -q commit -A -l - << EOF
447 > commit 1
448 >
449 > .. fix:: Title of First Fix
450 >
451 > First paragraph of fix 1.
452 > EOF
453
454 $ hg releasenote -r .
455 Bug Fixes
456 =========
457
458 Title of First Fix
459 ------------------
460
461 First paragraph of fix 1.
462
463 $ cd ..
464
465 Using multiple admonitions in same changeset
466
467 $ hg init relnotes-multiadmon
468 $ cd relnotes-multiadmon
469
470 $ touch file1
471 $ hg -q commit -A -l - << EOF
472 > commit 1
473 >
474 > .. feature::
475 >
476 > Details about new feature.
477 >
478 > .. perf::
479 >
480 > Improves the execution by 2x
481 > EOF
482
483 $ hg releasenotes -r . $TESTTMP/relnotes-multiple-admonitions
484 $ cat $TESTTMP/relnotes-multiple-admonitions
485 New Features
486 ============
487
488 * Details about new feature.
489
490 Performance Improvements
491 ========================
492
493 * Improves the execution by 2x