jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/752009 )
Change subject: Revert "[IMPR] Show a warning if a pagegenerator option is not enabled" ......................................................................
Revert "[IMPR] Show a warning if a pagegenerator option is not enabled"
This reverts commit 5c2715dadca6e44ae5532d5fe6fc6d47baaf9df0.
Reason for revert: failing tests
Change-Id: Ibf92d9477d9462ad8479cb5725572fc332843afb --- M scripts/category.py 1 file changed, 12 insertions(+), 16 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py index a14b477..e6523d1 100755 --- a/scripts/category.py +++ b/scripts/category.py @@ -23,6 +23,9 @@ -create - If a page doesn't exist, do not skip it, create it instead. -redirect - Follow redirects.
+If action is "add", the following options are supported: + +¶ms;
Options for "listify" action:
@@ -91,10 +94,6 @@ -depth: - The max depth limit beyond which no subcategories will be listed.
-If action is "add", the following additional options are supported: - -¶ms; - For the actions tidy and tree, the bot will store the category structure locally in category.dump. This saves time and server load, but if it uses these data later, they may be outdated; use the -rebuild parameter in this @@ -113,7 +112,7 @@ This will move all pages in the category US to the category United States. """ # -# (C) Pywikibot team, 2004-2022 +# (C) Pywikibot team, 2004-2021 # # Distributed under the terms of the MIT license. # @@ -1348,6 +1347,7 @@
# Process global args and prepare generator args parser local_args = pywikibot.handle_args(args) + gen_factory = pagegenerators.GeneratorFactory()
# When this is True then the custom edit summary given for removing # categories from articles will also be used as the deletion reason. @@ -1359,7 +1359,6 @@ follow_redirects = False delete_empty_cat = True unknown = [] - pg_options = [] for arg in local_args: if arg in ('add', 'remove', 'move', 'tidy', 'tree', 'listify'): action = arg @@ -1424,23 +1423,17 @@ elif option == 'prefix': prefix = value else: - pg_options.append(arg) + gen_factory.handle_arg(arg)
- enabled = ['namespace'] if action in ('tidy', 'listify') else None - if action in ('add', 'listify', 'tidy'): - gen_factory = pagegenerators.GeneratorFactory(enabled_options=enabled) - unknown += gen_factory.handle_args(pg_options) - else: - unknown += pg_options - suggest_help(unknown_parameters=unknown) + bot = None # type: Optional[BaseBot]
cat_db = CategoryDatabase(rebuild=rebuild) + gen = gen_factory.getCombinedGenerator()
if action == 'add': if not to_given: new_cat_title = pywikibot.input( 'Category to add (do not give namespace):') - gen = gen_factory.getCombinedGenerator() if not gen: # default for backwards compatibility gen_factory.handle_arg('-links') @@ -1517,8 +1510,9 @@ prefix=prefix, namespaces=gen_factory.namespaces)
- if suggest_help(missing_action=True): + if bot: pywikibot.Site().login() + suggest_help(unknown_parameters=unknown) try: bot.run() except Error: @@ -1526,6 +1520,8 @@ finally: if cat_db: cat_db.dump() + else: + suggest_help(missing_action=True, unknown_parameters=unknown)
if __name__ == '__main__':
pywikibot-commits@lists.wikimedia.org