jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/434147 )
Change subject: [IMPR] Add option to show more context to replace.py
......................................................................
[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(-)
Approvals:
Framawiki: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
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
https://gerrit.wikimedia.org/r/434147
To unsubscribe, visit
https://gerrit.wikimedia.org/r/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(a)seznam.cz>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
Gerrit-Reviewer: Bináris2 <wikiposta+wikitech(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm(a)member.fsf.org>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>