pub enum Checkout {
Ref {
refspec: String,
commit: String,
fork: Option<ForkRef>,
},
Patches {
base: Option<String>,
patches: Vec<Patch>,
},
ExternalCommand {
program: String,
args: Vec<String>,
env: Vec<(String, String)>,
},
}Variants§
Ref
e.g. GitHub: fetch refspec from the canonical repo’s own origin, expect it to resolve
to commit. The git backend only ever needs refspec/commit; fork, when present,
is used solely by the jj backend, which tracks the PR head’s own remote+branch rather
than importing an anonymous ref (see vcs::jj).
Patches
Apply patches bottom-to-top on top of base (or the canonical repo’s default branch
tip if base is unset). No current source produces this - moz_phab delegates the whole
apply step to the moz-phab CLI instead (see ExternalCommand) - but it’s kept as a
generic extension point for a future source that fetches raw diffs itself.
ExternalCommand
Delegate the entire checkout to an external command, run with the given env added and
cwd set to the workspace. The workspace starts at the canonical repo’s default branch
tip (same starting point as Patches with base: None) - the command is expected to
move it wherever it needs to itself (moz-phab patch --apply-to base resolves and checks
out the revision’s actual base on its own, including cases a source’s own Conduit calls
can’t cheaply replicate, like an unlanded base needing a git-cinnabar hg/git translation -
confirmed against real Mozilla Phabricator, not just moz-phab’s source). A nonzero exit
leaves the workspace in place for inspection, same as a failed Patches application.