Repository navigation
feat(pull): follow --category into subcategories with --depth - #41
Merged
Merged
Conversation
pull --depth N lists a category's subcategories N levels down, breadth first, and pulls their pages too. 0, the default, keeps the old behaviour. A visited set lists each category once, so subcategories reached by several paths and categories that contain each other end the walk. --max and the language filter apply to the pages of the whole tree, before any page text is fetched. The listing now asks for gcmtype=page|subcat, so each category costs one listing whatever the depth. On Appropedia, pull --category FAST: --depth 1 7 categories, 577 pages (refused at the default --max 500) --depth 5 12 categories, 590 pages (the tree ends at depth 2) Closes #21
CameronBrooks11
added a commit
that referenced
this pull request
Nov 13, 2026
chore: bump version to 0.4.0 Prepares v0.4.0: the version constant becomes 0.4.0, and the CHANGELOG's Unreleased section becomes 0.4.0. User-facing change since v0.3.1: #41 (pull --depth follows --category into subcategories, #21). CI action updates since then: #38, #39, #40. The tag is pushed after this merges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pull --depth Nfollows--categoryinto subcategories, N levels down. 0, the default, keeps today's behaviour.--categoryroots, so a subcategory reached by several paths is listed once and categories that contain each other don't loop.Water,Category:Waterandcategory:Waterare the same category.--maxand the language filter count the pages of the whole tree, before any page text is fetched.--categorytoday.--depthbelow 0, or without--category, is a usage error (exit 2).--depth, stderr says how many categories were walked.mw.CategoryMembersasks forgcmtype=page|subcatand returns pages and subcategory titles separately: one listing per category.On Appropedia (
./bin/wikisync pull --host www.appropedia.org --dir <scratch> --category FAST ...):--depth 1--max 500, exit 1--depth 1 --max 600--depth 5 --max 600An independent walk of the same tree with a separate script gave 577 and 590.
Each new test fails when the behaviour it names is broken: walking one level too far, dropping the visited check, not normalizing category names, dropping subcategory pages, not counting the walk, not splitting or not requesting subcategories, and accepting either bad
--depth.Closes #21