name: try-branches description: > Push several Firefox branches or commits to Mozilla try. Use when comparing try results across branches, revisions, or configurations. metadata: short-description: Compare try branches
Try Branches
Push a commit to the try server on multiple Firefox branches using the Lando API directly. This is useful for testing uplift compatibility on beta, release, and ESR branches.
Arguments
$ARGUMENTS should be: <commit-hash> <branch1> [branch2] ...
Where branches can be: beta, release, esr115, esr128, esr140, or any branch name
available under upstream/ remote (which should point to https://github.com/mozilla-firefox/firefox.git).
Example: /try-branches HEAD beta release esr128 esr115
Process
- Parse the commit hash and target branches from arguments
- Ensure
upstreamremote exists pointing tohttps://github.com/mozilla-firefox/firefox.git - Fetch the target branches from upstream if not already fetched
- For each target branch:
a. Create a temporary local branch
try-<branch>fromupstream/<branch>b. Cherry-pick the commit onto it c. If there are conflicts, resolve them and inform the user about the resolution d. Generate agit format-patchof the cherry-picked commit e. Push to try via the Lando API - Generate patch files in the repo root for any branches that required conflict resolution
- Switch back to the original branch
- Print a summary table with Treeherder links
Cherry-pick conflict handling
If a cherry-pick has conflicts:
- Try to resolve them automatically if possible
- If auto-resolution fails, abort, inform the user, and skip that branch
- For branches with resolved conflicts, generate a
.patchfile at the repo root (e.g.,esr115.patch)
Lando API push method
Use a Python script to call the Lando API directly. This avoids issues with mach try on older
branches that lack Lando support or have incompatible git-cinnabar requirements.
The script should:
- Read the auth token from
~/.mozbuild/lando_auth0_user_token.json - Generate the patch with
git format-patch -1 <commit> --stdout - Generate the correct
try_task_config.jsonas a second patch:{ "parameters": { "filters": ["try_auto"], "optimize_strategies": "gecko_taskgraph.optimize:tryselect.bugbug_reduced_manifests_config_selection_medium", "optimize_target_tasks": true, "test_manifest_loader": "bugbug", "try_mode": "try_auto", "try_task_config": {} }, "version": 2 } - POST to
https://api.lando.services.mozilla.com/try/patcheswith:{ "base_commit": "<upstream branch tip git SHA>", "base_commit_vcs": "git", "patch_format": "git-format-patch", "patches": ["<base64 commit patch>", "<base64 try_task_config patch>"] } - The try_task_config patch should be a valid
git format-patchstyle patch that createstry_task_config.json
Auth token
If the auth token at ~/.mozbuild/lando_auth0_user_token.json doesn't exist or is expired,
tell the user to run ./mach try auto on any branch first to authenticate, which will cache
the token.
Important notes
- Always switch back to the user's original branch when done
- Clean up any temporary state (stashed changes, staged files)
- The
try-<branch>local branches are left around for reference but can be deleted - If a branch already has a
try-<branch>local branch, delete and recreate it