PATCH: absorb another branch's work into the worktree

PATCH absorbs commits from another branch into cur's worktree and records the absorbed sha(s) in .be/wtlog for the next POST to consume; it never commits on its own. The cycle is patch test post, one absorption per landing commit so every commit that lands is a tested commit, never a chain of unverified work. PATCH is one verb in the Beagle Verbs vocabulary, and unlike GET it weave-merges theirs rather than overwriting the worktree.

Shapes and provenance

The URI slot picks WHAT is absorbed; the verb bang picks how the origin is recorded in the next commit. URI bangs are retired (the old ?br! whole-branch toggle is gone ?ref always takes the whole missing line); the bang rides the verb only, and PATCH never carries a #message.

Summary of invocation patterns

gritzko, no LLM edits allowed

PATCH applies changes from a commit/branch, thus implementing merge, rebase, cherry pick.

  1. patch comes in many forms:
    1. bare patch implies the tracked ref is the argument, so all the "miss" commits from that ref get applied and become "ptch"
    2. patch ?branch, patch ?tag, patch ?hash specify the commit line to patch in explicitly
    3. patch //worktree/path - worktree get (the actual tree base commit line)
    4. patch #hash cherry picks a particular commit, no parents, the hash is mentioned in a commit as "picked", not "parent"
    5. patch file:..., patch https:... and others imply the remote leg that updates remote refs, may download objects
  2. patch modes
    1. whole tree (default)
    2. patch path/file?ref scoped to file/dir
  3. commit history wise, the target ref can be
    1. behind, same as the current: nothing to do
    2. ahead, divergent: apply the missing
  4. patch submodule recursion
    1. does not recur with --nosub
    2. by default: recurs; the state of the local tree is only used by weave merge; if a submodule tracks something else but the pin, applies patches anyway
  5. merge/rebase
    1. default patch mentions the ref in the commit as non-first parent
    2. patch! forceful - mentions the the ref as foster (header not understood by git, so the object is not propagated to other replicas, for local reference only)

Ancestor-skip walk

An absorption replays only the commits cur doesn't already have the missing set of the target line, computed by reachability from cur.

Merge base: full stack vs single commit

The merge base splits by shape: a line absorption weaves the whole missing stack against auto-LCA(cur, theirs), while a cherry weaves one commit against its own parent. The git-visible operation is picked by the origin record (parent vs foster), not by the base.

Weave merge

PATCH never refuses on dirty files: it runs a 3-way WEAVE with the absorbed commit on the theirs side and the wt's current bytes on the ours side, so PATCH-on-PATCH composes by construction.

Path-scoped PATCH

A non-empty path slot scopes the absorption to those paths, but records no provenance a partial absorption is not a faithful DAG commit.

Reporting and status

Every PATCH prints a ULOG-style report one line per applied commit and touched file, <verb> <status> <path-or-uri> so the patch-test-post loop stays auditable.

Open questions

Two PATCH-side formats are still unsettled, both about how downstream tools read PATCH's output.