Skip to content

mw dev mediawiki apply-patches

Releasev0.35.0 · cfeceb67

mw dev mediawiki apply-patches [flags]

Fetch Gerrit changes into your development environment.

Given one or more Gerrit change numbers, this command will:

  1. Query the Gerrit API to determine the project, ref, and fetch URL
  2. Map the project to the correct local directory (core, extension, or skin)
  3. Ensure the repository exists locally (or clone it with --clone-missing)
  4. Stash any uncommitted local changes
  5. Fetch the change ref
  6. Apply it using the selected mode

By default, Depends-On: footers from commit messages are resolved and applied first. Dependency cycles are detected and handled safely (no infinite recursion).

When a Depends-On value is a non-unique Change-Id, resolution uses the start branch context (default master). Set --start-branch to match your target train/release branch for deterministic dependency resolution.

If a dependency points to a repository that is not present locally, the command fails by default. Use --clone-missing to allow automatic cloning.

Modes:

  • checkout (default): check out FETCH_HEAD as a detached HEAD (good for quickly testing exact patchset state)
  • cherry-pick: cherry-pick FETCH_HEAD into your current branch (good for stacking local changes)

This is useful for quickly testing patches from Gerrit in your local dev environment, similar to Patch Demo but running locally.

No Gerrit authentication is required.

--change <strings>
Gerrit change number(s) to apply (repeatable)
--clone-missing
Clone missing repositories automatically when needed
--dry-run
Show what would be done without actually doing it
--mode <string>
How to apply the fetched patchset: checkout or cherry-pick Default: checkout.
--start-branch <string>
Branch context used to resolve non-unique Change-Id values in Depends-On chains Default: master.
--with-deps
Resolve and apply Depends-On changes before the requested change(s) Default: true.
-c, --context <string>
Development context to use (overrides CONTEXT) Default: default.
--help
Help for this command
--no-interaction
Do not ask any interactive questions
-v, --verbose <count>
Increase output verbosity. Example: --verbose=2 or -vv
Terminal window
mw dev mediawiki apply-patches --change 1275105
mw dev mediawiki apply-patches --change 1275105 --change 1275106
mw dev mediawiki apply-patches --change 1275105 --mode checkout
mw dev mediawiki apply-patches --change 1275105 --mode cherry-pick
mw dev mediawiki apply-patches --change 1275105 --with-deps
mw dev mediawiki apply-patches --change 1275105 --start-branch wmf/1.47.0-wmf.1
mw dev mediawiki apply-patches --change 1275105 --with-deps --clone-missing
mw dev mediawiki apply-patches --change 1275105 --dry-run
Report an issue with this page

Report a documentation issue

The report includes this page’s link, section and documentation version.

Review and submit on Phabricator, or run the command using your saved CLI profile. The command asks before creating the task.