Add ability to disable revert detection
Also add test to ensure functionality works. Signed-off-by: Will Beason <willbeason@gmail.com>
This commit is contained in:
19
wikiq
19
wikiq
@@ -523,7 +523,11 @@ class WikiqParser:
|
||||
if namespace not in self.namespace_filter:
|
||||
continue
|
||||
|
||||
rev_detector = mwreverts.Detector(radius=self.revert_radius)
|
||||
# Disable detecting reverts if radius is 0.
|
||||
if self.revert_radius > 0:
|
||||
rev_detector = mwreverts.Detector(radius=self.revert_radius)
|
||||
else:
|
||||
rev_detector = None
|
||||
|
||||
if self.persist != PersistMethod.none:
|
||||
window = deque(maxlen=PERSISTENCE_RADIUS)
|
||||
@@ -574,13 +578,14 @@ class WikiqParser:
|
||||
rev_data.text_chars = len(rev.text)
|
||||
|
||||
# generate revert data
|
||||
revert = rev_detector.process(text_sha1, rev.id)
|
||||
if rev_detector is not None:
|
||||
revert = rev_detector.process(text_sha1, rev.id)
|
||||
|
||||
if revert:
|
||||
rev_data.revert = True
|
||||
rev_data.reverteds = revert.reverteds
|
||||
else:
|
||||
rev_data.revert = False
|
||||
if revert:
|
||||
rev_data.revert = True
|
||||
rev_data.reverteds = revert.reverteds
|
||||
else:
|
||||
rev_data.revert = False
|
||||
|
||||
# if the fact that the edit was minor can be hidden, this might be an issue
|
||||
rev_data.minor = rev.minor
|
||||
|
||||
Reference in New Issue
Block a user