jenkins-bot merged this change.

View Change

Approvals: Framawiki: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Add option to show more context to replace.py

Bug: T57059
Change-Id: I6cc3caab695989347cbb18a4b0c83bb6583d2376
---
M scripts/replace.py
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/replace.py b/scripts/replace.py
index 6ad8c62..ae6cf05 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -732,6 +732,7 @@
applied = set()
new_text = original_text
last_text = None
+ context = 0
while True:
if self.isTextExcepted(new_text):
pywikibot.output(u'Skipping %s because it contains text '
@@ -761,15 +762,18 @@
# Highlight the title in purple.
pywikibot.output(color_format(
'\n\n>>> {lightpurple}{0}{default} <<<', page.title()))
- pywikibot.showDiff(original_text, new_text)
+ pywikibot.showDiff(original_text, new_text, context=context)
if self.getOption('always'):
break
choice = pywikibot.input_choice(
u'Do you want to accept these changes?',
[('Yes', 'y'), ('No', 'n'), ('Edit original', 'e'),
- ('edit Latest', 'l'),
- ('open in Browser', 'b'), ('all', 'a')],
+ ('edit Latest', 'l'), ('open in Browser', 'b'),
+ ('More context', 'm'), ('All', 'a')],
default='N')
+ if choice == 'm':
+ context = context * 3 if context else 3
+ continue
if choice == 'e':
editor = editarticle.TextEditor()
as_edited = editor.edit(original_text)

To view, visit change 434147. To unsubscribe, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6cc3caab695989347cbb18a4b0c83bb6583d2376
Gerrit-Change-Number: 434147
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: BinĂ¡ris <wikiposta@gmail.com>
Gerrit-Reviewer: BinĂ¡ris2 <wikiposta+wikitech@gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm@member.fsf.org>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa@openmailbox.org>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot <>