Mercurial > hg
comparison hgext/releasenotes.py @ 34810:44bd29168d14
releasenotes: make the import of fuzzywuzzy optional
If fuzzywuzzy is note present, we will not be having the capability to merge
existing releasenotes with the new releasenotes on the similarity basis.
The merging will still work good for exact same releasenotes entries.
Differential Revision: https://phab.mercurial-scm.org/D1096
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 15 Oct 2017 20:29:16 +0530 |
parents | 070ba789f4d0 |
children | a542ad320adb |
comparison
equal
deleted
inserted
replaced
34809:3a65012be661 | 34810:44bd29168d14 |
---|---|
216 | 216 |
217 def similaritycheck(incoming_str, existingnotes): | 217 def similaritycheck(incoming_str, existingnotes): |
218 """ | 218 """ |
219 Returns false when note fragment can be merged to existing notes. | 219 Returns false when note fragment can be merged to existing notes. |
220 """ | 220 """ |
221 import fuzzywuzzy.fuzz as fuzz | 221 try: |
222 import fuzzywuzzy.fuzz as fuzz | |
223 fuzz.token_set_ratio | |
224 except ImportError: | |
225 return True | |
226 | |
222 merge = True | 227 merge = True |
223 for bullet in existingnotes: | 228 for bullet in existingnotes: |
224 score = fuzz.token_set_ratio(incoming_str, bullet) | 229 score = fuzz.token_set_ratio(incoming_str, bullet) |
225 if score > 75: | 230 if score > 75: |
226 merge = False | 231 merge = False |