Skip to content

feat: pull a set of pages by category, prefix, or everything tracked - #17

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/pull-sets
Oct 31, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/pull-sets

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

What

pull can take a whole set of pages:

wikisync pull --category "Simple living"
wikisync pull --prefix "User:CameronBrooks11/"
wikisync pull                     # nothing named: pull every tracked page again
  • --category and --prefix repeat and combine with explicit titles.
  • Translations are skipped by default. On Appropedia, many category members
    are machine translations by a bot (Page/es, Page/ar, …, each with its own
    page language). Listings use a generator with prop=info, so each page's
    language is known without fetching its text; only the wiki's own language is
    kept unless --all-languages is given. Titles named explicitly are always
    pulled.
  • --max (default 500) refuses an oversized selection after the language
    filter and before any page text is fetched.
  • Batch fetch: 50 titles per POST request (mw.FetchPages), with
    MediaWiki's title normalization mapped back to the requested title.
  • --prefix resolves the namespace from the wiki's own names and aliases, so
    Notes: draft in the main namespace isn't mistaken for a namespace.
  • Subcategories are not followed.
  • Writing, dirty-file, collision and baseline handling stay in core.Pull.
    core.PullSet only decides which pages and fetches them.

Verification

  • New tests: PullSet (translations skipped, --all-languages, explicit titles
    always pulled, the limit counted after filtering with nothing fetched when
    exceeded, Water_Pump/Water Pump requested once, bare pull refreshes
    tracked pages, nothing-to-pull, a selector matching nothing); client
    (siteinfo parsed and cached, category continuation, prefix namespace
    resolution including aliases and a colon that isn't a namespace, 51 titles in
    2 POSTs with normalization and a missing page).
  • Breaking each rule separately (language filter, limit after filter, explicit
    titles, underscore/space matching, refresh, continuation, normalization,
    namespace resolution, siteinfo cache) fails its target test.
  • Live and read-only against Appropedia with a built binary:
    • --prefix "User:CameronBrooks11/" pulled the 3 user subpages into
      User/CameronBrooks11/;
    • --category "Simple living" pulled 6 pages and skipped 15 translations
      (the category's 21 pages);
    • --category Water --max 100 was refused: "the selection has 231 pages";
    • bare pull re-pulled all 9 tracked pages, and status lists 9.

pull now takes --category and --prefix (both repeatable, combinable
with titles); with nothing named it pulls every tracked page again.

Listings come from a generator with prop=info, so each page's language
is known without fetching its text. Category and prefix results keep
only pages in the wiki's own language unless --all-languages is given:
on Appropedia, 15 of the 21 pages in Category:Simple living are machine
translations. The --max cap (default 500) is checked after that filter
and before any text is fetched; Category:Water is 231 pages after it.
Titles named explicitly are always pulled. Page text is fetched 50
titles per POST request, with MediaWiki's title normalization mapped
back to the requested title. Prefixes resolve their namespace from the
wiki's own namespace names and aliases. Subcategories are not followed.

Writing, dirty-file and collision handling stay in core.Pull.
@CameronBrooks11
CameronBrooks11 merged commit bb04e0e into main Oct 31, 2026
6 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/pull-sets branch October 31, 2026 00:16
@CameronBrooks11 CameronBrooks11 mentioned this pull request Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant