jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/780808 )
Change subject: [IMPR] add -quiet option to omit message when no change was made ......................................................................
[IMPR] add -quiet option to omit message when no change was made
with -quiet option the message "No changes were necessary in [[page]]" will be omitted because it can be too noisy.
Bug: T306134 Change-Id: I65d6269001920679878adcf5fb691ed3f6a643dd --- M scripts/replace.py 1 file changed, 7 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py index 7b748d3..bfd599a 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -91,6 +91,8 @@
-always Don't prompt you for each replacement
+-quiet Don't prompt a message if a page keeps unchanged + -recursive Recurse replacement as long as possible. Be careful, this might lead to an infinite loop.
@@ -532,6 +534,7 @@ self.available_options.update({ 'addcat': None, 'allowoverlap': False, + 'quiet': False, 'recursive': False, 'sleep': 0.0, 'summary': None, @@ -686,8 +689,9 @@ break
if new_text == original_text: - pywikibot.output('No changes were necessary in ' - + page.title(as_link=True)) + if not self.opt.quiet: + pywikibot.output('No changes were necessary in ' + + page.title(as_link=True)) return
if self.opt.addcat: @@ -933,7 +937,7 @@ fixes_set.append(value) elif opt == '-sleep': options['sleep'] = float(value) - elif opt in ('-allowoverlap', '-always', '-recursive'): + elif opt in ('-allowoverlap', '-always', '-quiet', '-recursive'): options[opt[1:]] = True elif opt == '-nocase': flags |= re.IGNORECASE