From: Ian Jackson Date: Fri, 27 Apr 2012 11:22:19 +0000 (+0100) Subject: strategy: wip, notation changes, finished planning we think X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topbloke-formulae.git;a=commitdiff_plain;h=edd89d19f03e82b54c2999319ac48fe20173ff6e strategy: wip, notation changes, finished planning we think --- diff --git a/article.tex b/article.tex index 02bf4ce..b37edd5 100644 --- a/article.tex +++ b/article.tex @@ -95,6 +95,15 @@ \newcommand{\eqntag}[2]{ #2 \tag*{\mbox{#1}} } \newcommand{\eqn}[2]{ #2 \tag*{\mbox{\bf #1}} } +\newcommand{\hasdirdep}{\succ_{\mkern-7.0mu _1}} +\newcommand{\hasdep}{\succ} +\newcommand{\isdep}{\prec} + +\newcommand{\grefzc}{ T^0_{\pc} } +\newcommand{\grefcc}{ T_{\pc} } +\newcommand{\grefuc}{ T'_{\pc} } +\newcommand{\greffc}{ T^*_{\pc} } + %\newcommand{\bigforall}{\mathop{\hbox{\huge$\forall$}}} \newcommand{\bigforall}{% \mathop{\mathchoice% diff --git a/strategy.tex b/strategy.tex index 4cd80db..a718aec 100644 --- a/strategy.tex +++ b/strategy.tex @@ -13,63 +13,93 @@ for $\patchof{L}$. The set of direct dependencies (in the form $\py$) requested in the commit $K$ ($K \in \pn$) for the patch $\p$. -\item[ $\pc \succ_1 \{ \p, \pq \ldots \}$ ] -The Topbloke commit set $\pc$ has as direct contributors -(see below) exactly $\p, \pq, \ldots$. This is an acyclic relation. +\item[ $\pc \hasdirdep \p$ ] +The Topbloke commit set $\pc$ has as a direct contributors the +commit set $\p$. This is an acyclic relation. -\item[ $\p \succ \pq$ ] +\item[ $\p \hasdep \pq$ ] The commit set $\p$ has as direct or indirect contributor the commit set $\pq$. -This is an acyclic relation, and is the completion of $\succ_1$ into a +Acyclic; the completion of $\hasdirdep$ into a partial order. \item[ $\set E_{\pc}$ ] $ \bigcup_i \pendsof{S_i}{\pc} $. All the ends of $\pc$ in the sources. +\item[ $ \grefzc, \grefcc, \grefuc, \greffc $ ] +The git ref for the Topbloke commit set $\pc$: respectively, +the original, current, updated, and final values. + \end{basedescript} \section{Planning phase} +The planning phase computes: +\begin{itemize*} +\item{ The relation $\hasdirdep$ and hence the ordering $\hasdep$. } +\item{ For each commit set $\pc$, the order in which to merge + $E_{\pc,j} \in \set E_{\pc}$. } +\item{ For each $E_{\pc,j}$ an intended merge base $M_{\pc,j}$. } +\end{itemize*} + We use a recursive planning algorith, recursing over Topbloke commit sets (ie, sets $\py$ or $\pn$). We'll call the commit set we're -processing at each step $\pc$. We start with $\pc = \pl$ -where $\pl = \patchof{L}$. - +processing at each step $\pc$. At each recursive step -we intend to merge all $\set E_{\pc} = \{ E_{\pc,j \ldots} \}$ +we make a plan 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$. +into $\grefzc$, to make $\greffc$. + +We start with $\pc = \pl$ where $\pl = \patchof{L}$. + -\subsection{Planning step for $\pc = \pcn$.} +\subsection{Direct contributors for $\pc = \pcn$} + +The direct contributors of $\pcn$ are the commit sets corresponding to +the tip branches for the direct dependencies of the patch $\pc$. We +need to calculate what the direct dependencies are going to be. 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 +a way not discussed here) ordering of $\set E_{\pc}$, $E_{\pc,j}$ +($j = 1 \ldots m$). +For brevity we will write $E_j$ for $E_{\pc,j}$. +Remove from that set (and ordering) any $E_j$ which are $\le$ and $\neq$ some other $E_k$. -Initially let $T_{\pc,0}$ be the git ref for $\pcn$. And let -$\set D_0 = \depsreqof{T_{\pc,0}}$. +Initially let $\set D_0 = \depsreqof{\grefzc}$. 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 $\set D_j$ as the 3-way merge of the sets $\set 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$. +generate $D_m$ as the putative direct contributors of $\pcn$. + +However, the invocation may give instructions 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 +(strictly, some arbitrary set of Topbloke tip commit sets). + +\subsection{Direct contributors for $\pc = \pcy$} + +The sole direct contributor of $\pcy$ is $\pcn$. + +\subsection{Recursive step} -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. +For each direct contributor $\p$, we add the edge $\pc \hasdirdep \p$ +and augment the ordering $\hasdep$ accordingly. +If this would make a cycle in $\hasdep$, we abort . The operation must +then be retried by the user, if desired, but with different or +additional instructions for modifying the direct contributors of some +$\pqn$ involved in the cycle. +For each such $\p$, after updating $\hasdep$, we recursively make a plan +for $\pc' = \p$. +\section{Execution phase} -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