jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Do not create a redirect loop while solving a broken
redirects
......................................................................
[FIX] Do not create a redirect loop while solving a broken redirects
- use redir_page to compare with movedTarget
- deletion request if redirect target could not be recovered
- new logic for final statement
Bug: T107695
Change-Id: I69f0da50ed2f9a6bf27337ab797a6b99e1ada50f
---
M scripts/redirect.py
1 file changed, 8 insertions(+), 4 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 81ad431..c955f2b 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -403,6 +403,7 @@
redir_page = redir_name
# Show the title of the page we're working on.
# Highlight the title in purple.
+ done = not self.getOption('delete')
pywikibot.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<"
% redir_page.title())
try:
@@ -433,8 +434,9 @@
# FIXME: Test to another move
pywikibot.output(u'Target page %s does not exist'
% (movedTarget))
- elif redir_name == movedTarget.title():
- pywikibot.output(u'Target page forms a redirect loop')
+ elif redir_page == movedTarget:
+ pywikibot.output(
+ 'Redirect to target page forms a redirect loop')
else:
pywikibot.output(u'%s has been moved to %s'
% (redir_page, movedTarget))
@@ -462,7 +464,9 @@
% redir_page.title())
except pywikibot.OtherPageSaveError:
pywikibot.exception()
- elif self.getOption('delete') and self.user_confirm(
+ else:
+ done = True
+ if not done and self.user_confirm(
u'Redirect target %s does not exist.\n'
u'Do you want to delete %s?'
% (targetPage.title(asLink=True),
@@ -493,7 +497,7 @@
else:
pywikibot.output(
u'No speedy deletion template available')
- else:
+ elif not (self.getOption('delete') or movedTarget):
pywikibot.output(u'Cannot fix or delete the broken
redirect')
except pywikibot.IsRedirectPage:
pywikibot.output(u"Redirect target %s is also a redirect! "
--
To view, visit https://gerrit.wikimedia.org/r/228653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I69f0da50ed2f9a6bf27337ab797a6b99e1ada50f
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Russell Blau <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits