jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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

To view, visit change 780808. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I65d6269001920679878adcf5fb691ed3f6a643dd
Gerrit-Change-Number: 780808
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged