+\stdsection{Inputs to the update algorithm}
+
+\begin{basedescript}{
+\desclabelwidth{5em}
+\desclabelstyle{\nextlinelabel}
+}
+\item[ $\pc_0$ ]
+The topmost patch which we are trying to update. This and
+all of its dependencies will be updated.
+
+\item[ $h : \pc^{+/-} \mapsto \set H_{\pc^{+/-}}$ ]
+Function for getting the existing heads $\set H$ of the branch $\pc^{+/-}$.
+This will include the current local and remote git refs, as desired.
+
+\item[ $g : \pc, \Gamma \mapsto \Gamma'$ ]
+Function to allow explicit adjustment of the direct dependencies
+of $\pc$. It is provided with a putative set of direct dependencies
+$\Gamma$ computed as an appropriate merge of the dependencies requested by the
+sources and should return the complete actual set $\Gamma'$ of direct
+dependencies to use. This allows the specification of any desired
+(acyclic) relation $\hasdirdep$.
+
+\end{basedescript}
+
+\section{Ranking phase}
+
+We run the following algorithm:
+\begin{enumerate}
+\item Set $\allpatches = \{ \}$.
+\item Repeatedly:
+\begin{enumerate}
+\item Clear out the graph $\hasdirdep$ so it has neither nodes nor edges.
+\item Execute {\bf Rank-Recurse}($\pc_0$)
+\item Until $\allpatches$ remains unchanged.
+\end{enumerate}
+\end{enumerate}
+
+{\bf Rank-Recurse}($\pc$) is:
+\begin{enumerate}
+\item Add $\pc$ to $\allpatches$ if it is not there already.
+\item Let $\set S_{\pcn} = h(\pcn)
+ \cup
+ \bigcup_{\p \in \allpatches}
+ \bigcup_{H \in h(\pn) \lor H \in h(\py)}
+ \{ \baseof{E} \; | \; E \in \pendsof{H}{\pcy} \} $
+
+and $W = w(h(\pcn))$
+
+We write $\set S = \set S_{\pcn}$ where unambiguous.
+\item While $\exists_{S \in \set S} S \ge W$:
+
+Update $W \assign S$ and $\set S \assign \set S \, \backslash \{ S \}$
+\end{enumerate}
+