Debian Codegraph @

tests/test-releasenotes-merging.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 directive from commit message is added to release notes
12
13 $ touch fix1
14 $ hg -q commit -A -l - << EOF
15 > commit 1
16 >
17 > .. fix::
18 >
19 > Fix from commit message.
20 > EOF
21
22 $ cat >> $TESTTMP/single-fix-bullet << EOF
23 > Bug Fixes
24 > =========
25 >
26 > * Fix from release notes.
27 > EOF
28
29 $ hg releasenotes -r . $TESTTMP/single-fix-bullet
30
31 $ cat $TESTTMP/single-fix-bullet
32 Bug Fixes
33 =========
34
35 * Fix from release notes.
36
37 * Fix from commit message.
38
39 Processing again ignores the already added bullet.
40
41 $ hg releasenotes -r . $TESTTMP/single-fix-bullet
42
43 $ cat $TESTTMP/single-fix-bullet
44 Bug Fixes
45 =========
46
47 * Fix from release notes.
48
49 * Fix from commit message.
50
51 $ cd ..
52
53 Sections are unioned
54
55 $ hg init subsections
56 $ cd subsections
57 $ touch fix1
58 $ hg -q commit -A -l - << EOF
59 > Commit 1
60 >
61 > .. feature:: Commit Message Feature
62 >
63 > This describes a feature from a commit message.
64 > EOF
65
66 $ cat >> $TESTTMP/single-feature-section << EOF
67 > New Features
68 > ============
69 >
70 > Notes Feature
71 > -------------
72 >
73 > This describes a feature from a release notes file.
74 > EOF
75
76 $ hg releasenotes -r . $TESTTMP/single-feature-section
77
78 $ cat $TESTTMP/single-feature-section
79 New Features
80 ============
81
82 Notes Feature
83 -------------
84
85 This describes a feature from a release notes file.
86
87 Commit Message Feature
88 ----------------------
89
90 This describes a feature from a commit message.
91
92 Doing it again won't add another section
93
94 $ hg releasenotes -r . $TESTTMP/single-feature-section
95 Commit Message Feature already exists in feature section; ignoring
96
97 $ cat $TESTTMP/single-feature-section
98 New Features
99 ============
100
101 Notes Feature
102 -------------
103
104 This describes a feature from a release notes file.
105
106 Commit Message Feature
107 ----------------------
108
109 This describes a feature from a commit message.
110
111 $ cd ..
112
113 Bullets from rev merge with those from notes file.
114
115 $ hg init bullets
116 $ cd bullets
117 $ touch fix1
118 $ hg -q commit -A -l - << EOF
119 > commit 1
120 >
121 > .. fix::
122 >
123 > this is fix1.
124 > EOF
125
126 $ touch fix2
127 $ hg -q commit -A -l - << EOF
128 > commit 2
129 >
130 > .. fix::
131 >
132 > this is fix2.
133 > EOF
134
135 $ hg releasenotes -r 'all()' $TESTTMP/relnotes-bullet-problem
136 $ cat $TESTTMP/relnotes-bullet-problem
137 Bug Fixes
138 =========
139
140 * this is fix1.
141
142 * this is fix2.
143 $ touch fix3
144 $ hg -q commit -A -l - << EOF
145 > commit 3
146 >
147 > .. fix::
148 >
149 > this is fix3.
150 > EOF
151
152 $ hg releasenotes -r . $TESTTMP/relnotes-bullet-problem
153 $ cat $TESTTMP/relnotes-bullet-problem
154 Bug Fixes
155 =========
156
157 * this is fix1.
158
159 * this is fix2.
160
161 * this is fix3.
162
163 $ cd ..
164
165 Ignores commit messages containing issueNNNN based on issue number.
166
167 $ hg init simple-fuzzrepo
168 $ cd simple-fuzzrepo
169 $ touch fix1
170 $ hg -q commit -A -l - << EOF
171 > commit 1
172 >
173 > .. fix::
174 >
175 > Resolved issue4567.
176 > EOF
177
178 $ cat >> $TESTTMP/issue-number-notes << EOF
179 > Bug Fixes
180 > =========
181 >
182 > * Fixed issue1234 related to XYZ.
183 >
184 > * Fixed issue4567 related to ABC.
185 >
186 > * Fixed issue3986 related to PQR.
187 > EOF
188
189 $ hg releasenotes -r . $TESTTMP/issue-number-notes
190 "issue4567" already exists in notes; ignoring
191
192 $ cat $TESTTMP/issue-number-notes
193 Bug Fixes
194 =========
195
196 * Fixed issue1234 related to XYZ.
197
198 * Fixed issue4567 related to ABC.
199
200 * Fixed issue3986 related to PQR.
201
202 $ cd ..
203
204 Adds short commit messages (words < 10) without
205 comparison unless there is an exact match.
206
207 $ hg init tempdir
208 $ cd tempdir
209 $ touch feature1
210 $ hg -q commit -A -l - << EOF
211 > commit 1
212 >
213 > .. feature::
214 >
215 > Adds a new feature 1.
216 > EOF
217
218 $ hg releasenotes -r . $TESTTMP/short-sentence-notes
219
220 $ touch feature2
221 $ hg -q commit -A -l - << EOF
222 > commit 2
223 >
224 > .. feature::
225 >
226 > Adds a new feature 2.
227 > EOF
228
229 $ hg releasenotes -r . $TESTTMP/short-sentence-notes
230 $ cat $TESTTMP/short-sentence-notes
231 New Features
232 ============
233
234 * Adds a new feature 1.
235
236 * Adds a new feature 2.
237
238 $ cd ..
239
240 Ignores commit messages based on fuzzy comparison.
241
242 $ hg init fuzznotes
243 $ cd fuzznotes
244 $ touch fix1
245 $ hg -q commit -A -l - << EOF
246 > commit 1
247 >
248 > .. fix::
249 >
250 > This is a fix with another line.
251 > And it is a big one.
252 > EOF
253
254 $ cat >> $TESTTMP/fuzz-ignore-notes << EOF
255 > Bug Fixes
256 > =========
257 >
258 > * Fixed issue4567 by improving X.
259 >
260 > * This is the first line. This is next line with one newline.
261 >
262 > This is another line written after two newlines. This is going to be a big one.
263 >
264 > * This fixes another problem.
265 > EOF
266
267 $ hg releasenotes -r . $TESTTMP/fuzz-ignore-notes
268 "This is a fix with another line. And it is a big one." already exists in notes file; ignoring
269
270 $ cat $TESTTMP/fuzz-ignore-notes
271 Bug Fixes
272 =========
273
274 * Fixed issue4567 by improving X.
275
276 * This is the first line. This is next line with one newline.
277
278 This is another line written after two newlines. This is going to be a big
279 one.
280
281 * This fixes another problem.