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 11A 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 30A 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 55A 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 84Formatting 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 132Formatting 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 179Section 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 225Now 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 262Multiple '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 333Using 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 358Overriding 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 383Testing 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 > .. asf:: 391 > 392 > First paragraph under this admonition. 393 > EOF 394 395Suggest similar admonition in place of the invalid one. 396 397 $ hg releasenotes -r . -c 398 Invalid admonition 'asf' present in changeset 4026fe9e1c20 399 400 $ touch b 401 $ hg -q commit -A -l - << EOF 402 > .. fixes:: 403 > 404 > First paragraph under this admonition. 405 > EOF 406 407 $ hg releasenotes -r . -c 408 Invalid admonition 'fixes' present in changeset 0e7130d2705c 409 (did you mean fix?) 410 411 $ cd .. 412 413Usage of --list flag 414 415 $ hg init relnotes-list 416 $ cd relnotes-list 417 $ hg releasenotes -l 418 feature: New Features 419 bc: Backwards Compatibility Changes 420 fix: Bug Fixes 421 perf: Performance Improvements 422 api: API Changes 423 424 $ cd .. 425 426Raise error on simultaneous usage of flags 427 428 $ hg init relnotes-raise-error 429 $ cd relnotes-raise-error 430 $ hg releasenotes -r . -l 431 abort: cannot specify both --list and --rev 432 [10] 433 434 $ hg releasenotes -l -c 435 abort: cannot specify both --list and --check 436 [10] 437 438Display release notes for specified revs if no file is mentioned 439 440 $ hg init relnotes-nofile 441 $ cd relnotes-nofile 442 443 $ touch fix1 444 $ hg -q commit -A -l - << EOF 445 > commit 1 446 > 447 > .. fix:: Title of First Fix 448 > 449 > First paragraph of fix 1. 450 > EOF 451 452 $ hg releasenote -r . 453 Bug Fixes 454 ========= 455 456 Title of First Fix 457 ------------------ 458 459 First paragraph of fix 1. 460 461 $ cd .. 462 463Using multiple admonitions in same changeset 464 465 $ hg init relnotes-multiadmon 466 $ cd relnotes-multiadmon 467 468 $ touch file1 469 $ hg -q commit -A -l - << EOF 470 > commit 1 471 > 472 > .. feature:: 473 > 474 > Details about new feature. 475 > 476 > .. perf:: 477 > 478 > Improves the execution by 2x 479 > EOF 480 481 $ hg releasenotes -r . $TESTTMP/relnotes-multiple-admonitions 482 $ cat $TESTTMP/relnotes-multiple-admonitions 483 New Features 484 ============ 485 486 * Details about new feature. 487 488 Performance Improvements 489 ======================== 490 491 * Improves the execution by 2x 492