Mercurial > hg
comparison tests/test-releasenotes-merging.t @ 33698:3748098d072a
releasenotes: add similarity check function to compare incoming notes
It is possible that the incoming note fragments have some similar content as the
existing release notes. In case of a bug fix, we match for issueNNNN in the
existing notes. For other general cases, it makes use of fuzzywuzzy library to get
a similarity score. If the score is above a certain threshold, we ignore the
fragment, otherwise add it. But the score might be misleading for small commit
messages. So, it uses similarity function only if the length of string (in words)
is above a certain value. The patch adds tests related to its usage. But it needs
improvement in the sense of combining incoming notes. We can use interactive mode
for adding notes. Maybe we can do this if similarity is under a certain range.
author | Rishabh Madan <rishabhmadan96@gmail.com> |
---|---|
date | Sat, 05 Aug 2017 05:25:36 +0530 |
parents | 5814db57941c |
children |
comparison
equal
deleted
inserted
replaced
33697:4d1e79945c2e | 33698:3748098d072a |
---|---|
1 #require fuzzywuzzy | |
2 | |
1 $ cat >> $HGRCPATH << EOF | 3 $ cat >> $HGRCPATH << EOF |
2 > [extensions] | 4 > [extensions] |
3 > releasenotes= | 5 > releasenotes= |
4 > EOF | 6 > EOF |
5 | 7 |
156 | 158 |
157 * this is fix2. | 159 * this is fix2. |
158 | 160 |
159 * this is fix3. | 161 * this is fix3. |
160 | 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. |