jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1055596?usp=email )
Change subject: [IMPR] show the current redirect target with redirect summary ......................................................................
[IMPR] show the current redirect target with redirect summary
Bug: T254839 Change-Id: Ib56053e5885f3e76a30e4fa1698a18ecd2f76bd4 --- M scripts/redirect.py 1 file changed, 7 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/redirect.py b/scripts/redirect.py index c415c2d..faeca78 100755 --- a/scripts/redirect.py +++ b/scripts/redirect.py @@ -529,7 +529,8 @@ f'{redir_page} has been moved to {movedTarget}') reason = i18n.twtranslate( redir_page.site, 'redirect-fix-broken-moved', - {'to': movedTarget.title(as_link=True, + {'from': targetPage.title(allow_interwiki=False), + 'to': movedTarget.title(as_link=True, allow_interwiki=False)}, bot_prefix=True) content = redir_page.get(get_redirect=True) @@ -607,6 +608,7 @@ """Treat one double redirect.""" newRedir = redir = self.current_page redirList = [] # bookkeeping to detect loops + first_target = None while True: redirList.append( f'{newRedir.site.lang}:{newRedir.title(with_section=False)}') @@ -619,6 +621,7 @@ if not targetPage: break
+ first_target = first_target or targetPage pywikibot.info(f' Links to: {targetPage}.') mw_msg = None with suppress(KeyError): @@ -663,7 +666,9 @@ save=False) summary = i18n.twtranslate( redir.site, 'redirect-fix-double', - {'to': targetPage.title(as_link=True, allow_interwiki=False)}, + {'from': first_target.title(as_link=True, + allow_interwiki=False), + 'to': targetPage.title(as_link=True, allow_interwiki=False)}, bot_prefix=True) self.userPut(redir, oldText, redir.text, summary=summary, ignore_save_related_errors=True,
pywikibot-commits@lists.wikimedia.org