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)
pywikibot-commits@lists.wikimedia.org