\section{Strategy}

We start with some commits $S_0 \ldots S_n$
(where $S_0 = L$ and is the current git ref for $\pl$).

%Let $\set E_{\pc} = \bigcup_i \pendsof{S_i}{\pc}$.

Invoke Plan $\patchof \pl$ where the algorithm Plan $\pc$ is as
follows:

Notation:

 $\pc \succ_1 \{ \p, \pq \ldots \}$ 
 the Topbloke commit set $py$ has as direct contributors exactly
 $\p, \pq, \ldots$.  This is an acyclic relation.

 Extend this into the partial order $\succ$.

$\py \succ \pq$ 

We intend to merge all $\set E_{\pc} = \{ E_{\pc,j \ldots} \}$
and all the direct contributors of $\pc$ (as determined below)
into the existing git ref for $\pc$, to make $T_{\pc}$.
The direct contributors of $\pcn$ are the topbloke commit sets
corresponding to the tip branches for the direct dependencies of
$\pc$.
The sole direct contributor of $\pcy$ is $\pcn$.


For $\pc = \pcn$, choose an (arbitrary, but ideally somehow optimal in
a way not discussed here) ordering of $\set E_{\pc}$, $E_j$ (for
$j = 1 \ldots m$).  Remove from that set (and ordering) any $E_j$ which
are $\le$ and $\neq$ some other $E_k$.

Notation: write $\depsreqof{K}$ to mean the direct dependencies
(in the form $\py$) requested in the commit $K$.

Initially let $T_{\pc,0}$ be the git ref for $\pcn$.  And let
$\set D_0 = \depsreqof{T_{\pc,0}}$.
For each $E_j$ starting with $j=1$ choose a corresponding intended
merge base $M_j$ such that $M_j \le E_j \land M_j \le T_{\pc,j-1}$.
Calculate $D_j$ as the 3-way merge of the sets $D_{j-1}$ and
$\depsreqof{E_j}$ using as a base $\depsreqof{M_j}$.  This will
generate $D_m$ as the putative direct contributors for $\pcn$.

However, the invocation may specify that certain direct dependencies
are definitely to be included, or excluded.  As a result the set
of actual direct contributors is some arbitrary set of patches.






Imagine that we will merge the direct 

with $M=M_j, L=T_{\pc,j-1}, R=E_j$,
and calculate what the resulting desired direct dependencies file
(ie, the set of patches $\set D_j$)
would be.  Eventually we 

So, formally, we select somehow an order of sources $S_i$.  For each 


Make use of the following recursive algorithm, Plan 




 recursively make a plan to merge all $E = \pends$

Specifically, in
