1 When we are trying to do a merge of some kind, in general,
2 we want to merge some source commits $S_0 \ldots S_n$.
3 We'll write $S_0 = L$. We require that $L$ is the current git ref
10 \desclabelstyle{\nextlinelabel}
12 \item[ $\depsreqof{K}$ ]
13 The set of direct dependencies (in the form $\py$)
14 requested in the commit $K$ ($K \in \pn$) for the patch $\p$.
16 \item[ $\pc \succ_1 \{ \p, \pq \ldots \}$ ]
17 The Topbloke commit set $\pc$ has as direct contributors
18 (see below) exactly $\p, \pq, \ldots$. This is an acyclic relation.
20 \item[ $\p \succ \pq$ ]
21 The commit set $\p$ has as direct or indirect contributor the commit
23 This is an acyclic relation, and is the completion of $\succ_1$ into a
26 \item[ $\set E_{\pc}$ ]
27 $ \bigcup_i \pendsof{S_i}{\pc} $.
28 All the ends of $\pc$ in the sources.
32 \section{Planning phase}
34 We use a recursive planning algorith, recursing over Topbloke commit
35 sets (ie, sets $\py$ or $\pn$). We'll call the commit set we're
36 processing at each step $\pc$. We start with $\pc = \pl$
37 where $\pl = \patchof{L}$.
39 At each recursive step
40 we intend to merge all $\set E_{\pc} = \{ E_{\pc,j \ldots} \}$
41 and all the direct contributors of $\pc$ (as determined below)
42 into the existing git ref for $\pc$, to make $T_{\pc}$.
43 The direct contributors of $\pcn$ are the Topbloke commit sets
44 corresponding to the tip branches for the direct dependencies of
46 The sole direct contributor of $\pcy$ is $\pcn$.
48 \subsection{Planning step for $\pc = \pcn$.}
50 Choose an (arbitrary, but ideally somehow optimal in
51 a way not discussed here) ordering of $\set E_{\pc}$, $E_j$ (for
52 $j = 1 \ldots m$). Remove from that set (and ordering) any $E_j$ which
53 are $\le$ and $\neq$ some other $E_k$.
55 Initially let $T_{\pc,0}$ be the git ref for $\pcn$. And let
56 $\set D_0 = \depsreqof{T_{\pc,0}}$.
57 For each $E_j$ starting with $j=1$ choose a corresponding intended
58 merge base $M_j$ such that $M_j \le E_j \land M_j \le T_{\pc,j-1}$.
59 Calculate $\set D_j$ as the 3-way merge of the sets $\set D_{j-1}$ and
60 $\depsreqof{E_j}$ using as a base $\depsreqof{M_j}$. This will
61 generate $D_m$ as the putative direct contributors for $\pcn$.
63 However, the invocation may specify that certain direct dependencies
64 are definitely to be included, or excluded. As a result the set
65 of actual direct contributors is some arbitrary set of patches.
72 Imagine that we will merge the direct
74 with $M=M_j, L=T_{\pc,j-1}, R=E_j$,
75 and calculate what the resulting desired direct dependencies file
76 (ie, the set of patches $\set D_j$)
77 would be. Eventually we
79 So, formally, we select somehow an order of sources $S_i$. For each
82 Make use of the following recursive algorithm, Plan
87 recursively make a plan to merge all $E = \pends$