Skip to main content

fetch_local

Function fetch_local 

Source
pub async fn fetch_local(
    sources: &[Box<dyn ReviewSource>],
    paths: &Paths,
    config: &Config,
    key: &ReviewKey,
    on_missing: OnMissing,
) -> Result<PathBuf>
Expand description

Resolve a canonical repo (asking before cloning one, unless on_missing says otherwise) and make sure key, a review already tracked by a prior sync(), has a workspace - the one for its whole stack - then move that workspace to key’s own patch. If the stack is already checked out this is just the move (skipped when the workspace has local changes, which are never disturbed); an ApplyFailed workspace is instead cleaned up and rebuilt, since handing back a broken/empty path again would just repeat the failure silently. This is the on-demand counterpart to sync()’s deliberate refusal to create workspaces on its own - see the module docs.

Under OnMissing::Ask, a repo with no local checkout surfaces as a repo::NeedsClone error (downcast_ref it) rather than cloning - callers should confirm with the user and retry with OnMissing::Clone if they agree.