Work concurrently with docks and lanes

Work concurrently with docks and lanes

A lane is a second working directory over the same store, with its own working change, tip and operation log, and no second clone. A named lane is a dock. Use lanes when several people or agents work in one repo at once.

Spawn a lane

Run this in the primary, the directory you ran loot init in. Set LOOT_SESSION first. Each lane records the session that spawned it, and without the variable every process gets a fresh label, so your next command can no longer reap the lanes this one spawned.

export LOOT_SESSION=me
loot lane new --name feat
lane 'lane-b86e11' at …/app-lanes/lane-b86e11 — sealed over this repo's store, born at the finalized tip
  hold: every Internal key, no Restricted key — restricted paths are absent from its tree (`loot lane new --hold-restricted` overrides)
  named 'feat' — persists until `loot lane rm feat`

The lane sits beside the repo in <repo>-lanes/ unless you pass --at <dir>, and starts at the primary’s last finalized change. It holds every Internal key and no Restricted key, so restricted paths are missing from its tree until you spawn it with --hold-restricted. Without --name a lane is ephemeral, and loot lane gc reaps it once it goes stale (24 hours by default). Run loot lane name <n> inside an unnamed lane to keep it.

Work in it

cd to the path it printed and work as usual: loot describe, loot new, loot undo. Each lane has its own operation log, so an undo in one lane never moves another. A change you finalize goes into the shared store at once.

See every lane

$ loot lanes
* lane-b86e11      feat             …/app-lanes/lane-b86e11  tip 0ba8e752  (heartbeat 0s ago)  [mine]

* = spawned by this session ('me'); reaping anything else needs `--reap-others`

It is read-only, so check it before you reap anything. --porcelain and --json give scripts the same rows.

The primary stops authoring

While any lane is live, naming a change in the primary refuses. Your edits are captured before the refusal, and it prints the command that copies them into a lane:

loot lane take feat notes.txt
cd ../app-lanes/lane-b86e11 && loot describe -m "add notes"

A take is a copy: the primary keeps its bytes. If the shared tree really is yours alone, --allow-primary on describe or new overrides the refusal.

Get the work out

Finalize the lane’s work, then land it from the primary and push from there:

cd ../app
loot lane land feat   # the primary takes the lane's finalized line
loot push

The primary fast-forwards onto the lane’s change when it is behind it. When another lane landed first, the two lines are folded in a signed merge, and a path both changed goes to loot conflicts and loot resolve. The land refuses a lane, or a primary, that holds work no change has signed. A forge refuses a push from a lane, so the primary is where a forge push starts.

A relay takes a push from a lane too: it shares the primary’s remotes, and an ordinary clone that runs loot pull takes every lane’s line and converges them.

In a repo with a git mirror bound with loot ferry --git-dir, loot lane land refuses: the main branch there moves through the mirror, loot ferry run in a lane refuses to move it, and this release ships no verb that lands a lane onto it. loot adopt catches a position up to work already landed on the mirror’s main branch.

Another lane that pulls the line opens its new Internal files but never its Restricted ones, and it doesn’t move onto the line either. Once that lane finalizes a change of its own, loot converge merges the two.

Clean up

loot lane rm feat   # one lane, named or not
loot lane gc        # every stale unnamed lane this session spawned

A reap deletes the lane’s directory and can’t be undone. Unsigned work dies with the directory, so finalize it first. loot lane rm refuses a lane whose finalized change nothing else holds, because no verb reaches that change once the lane is gone: land it, or pass --unlanded to give it up. A lane another session spawned is refused by rm and skipped by gc unless you pass --reap-others.