jenkins-bot has submitted this change and it was merged.
Change subject: Don't duplicate category names in CFD move edit summaries
......................................................................
Don't duplicate category names in CFD move edit summaries
The built-in category moving functionality that MediaWiki now has
already includes links to the relevant categories by default, so it
no longer makes sense to use the same edit summary from the page
edits (which do need to link to the category pages).
Bug: T135298
Change-Id: I03e8975d00221a5d53b78b73149f6e830bd66eec
---
M scripts/category.py
M scripts/cfd.py
2 files changed, 25 insertions(+), 13 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index b3281e0..2a9cae0 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -414,6 +414,7 @@
inplace=False, move_oldcat=True, delete_oldcat=True,
title_regex=None, history=False, pagesonly=False,
deletion_comment=DELETION_COMMENT_AUTOMATIC,
+ move_comment=None,
wikibase=True, allow_split=False, move_together=False,
keep_sortkey=None):
"""Store all given parameters in the objects attributes.
@@ -421,8 +422,8 @@
@param oldcat: The move source.
@param newcat: The move target.
@param batch: If True the user has not to confirm the deletion.
- @param comment: The edit summary for all pages where the
- category is changed.
+ @param comment: The edit summary for all pages where the category is
+ changed, and also for moves and deletions if not overridden.
@param inplace: If True the categories are not reordered.
@param move_oldcat: If True the category page (and talkpage) is
copied to the new category.
@@ -436,9 +437,12 @@
@param deletion_comment: Either string or special value:
DELETION_COMMENT_AUTOMATIC: use a generated message,
DELETION_COMMENT_SAME_AS_EDIT_COMMENT: use the same message for
- delete that is also used for move.
- If the value is not recognized, it's interpreted as
- DELETION_COMMENT_AUTOMATIC.
+ delete that is used for the edit summary of the pages whose
+ category was changed (see the comment param above). If the value
+ is not recognized, it's interpreted as DELETION_COMMENT_AUTOMATIC.
+ @param move_comment: If set, uses this as the edit summary on the
+ actual move of the category page. Otherwise, defaults to the value
+ of the comment parameter.
@param wikibase: If True, update the Wikibase item of the
old category.
@param allow_split: If False only moves page and talk page together.
@@ -513,6 +517,7 @@
# Category is deleted.
self.deletion_comment = i18n.twtranslate(self.site,
'category-was-disbanded')
+ self.move_comment = move_comment if move_comment else self.comment
def run(self):
"""The main bot function that does all the work.
@@ -545,7 +550,7 @@
old_cat_title = self.oldcat.title()
old_cat_text = self.oldcat.text
self.newcat = self.oldcat.move(self.newcat.title(),
- reason=self.comment,
+ reason=self.move_comment,
movetalkpage=can_move_talk)
# Copy over the article text so it can be stripped of
# CFD templates and re-saved. This is faster than
diff --git a/scripts/cfd.py b/scripts/cfd.py
index 4655b57..b301919 100755
--- a/scripts/cfd.py
+++ b/scripts/cfd.py
@@ -90,9 +90,10 @@
page = pywikibot.Page(pywikibot.Site(), cfdPage)
# Variable declarations
- day = "None"
- mode = "None"
- summary = ""
+ day = 'None'
+ mode = 'None'
+ summary = ''
+ action_summary = ''
robot = None
m = ReCheck()
@@ -130,26 +131,30 @@
summary = (
'Robot - Moving category ' + src + ' to [[:Category:'
+
dest + ']] per [[WP:CFD|CFD]] at ' + thisDay + '.')
+ action_summary = 'Robot - Result of [[WP:CFD|CFD]] at ' + thisDay
+ '.'
elif mode == "Speedy":
summary = (
'Robot - Speedily moving category ' + src +
' to [[:Category:' + dest + ']] per
[[WP:CFDS|CFDS]].')
+ action_summary = 'Robot - Speedily moved per [[WP:CFDS|CFDS]].'
else:
continue
# If the category is redirect, we do NOT want to move articles to
# it. The safest thing to do here is abort and wait for human
# intervention.
- destpage = pywikibot.Page(
- pywikibot.Site(), dest, ns=14)
+ destpage = pywikibot.Page(page.site, dest, ns=14)
if destpage.isCategoryRedirect():
summary = 'CANCELED. Destination is redirect: ' + summary
pywikibot.stdout(summary)
robot = None
else:
+ deletion_comment_same = (
+ CategoryMoveBot.DELETION_COMMENT_SAME_AS_EDIT_COMMENT)
robot = CategoryMoveBot(oldcat=src, newcat=dest, batch=True,
comment=summary, inplace=True,
move_oldcat=True, delete_oldcat=True,
- deletion_comment=True)
+ deletion_comment=deletion_comment_same,
+ move_comment=action_summary)
elif m.check(deletecat, line):
src = m.result.group(1)
# I currently don't see any reason to handle these two cases
@@ -161,10 +166,12 @@
summary = (
'Robot - Removing category {0} per [[WP:CFD|CFD]] '
'at {1}.'.format(src, thisDay))
+ action_summary = 'Robot - Result of [[WP:CFD|CFD]] at ' + thisDay
+ '.'
else:
continue
robot = CategoryMoveBot(oldcat=src, batch=True, comment=summary,
- deletion_comment=True, inplace=True)
+ deletion_comment=action_summary,
+ inplace=True)
else:
# This line does not fit any of our regular expressions,
# so ignore it.
--
To view, visit
https://gerrit.wikimedia.org/r/283838
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I03e8975d00221a5d53b78b73149f6e830bd66eec
Gerrit-PatchSet: 7
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Cyde <cydeweys(a)gmail.com>
Gerrit-Reviewer: Cyde <cydeweys(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>