[PATCH 4 of 6] phases: add a function to compute heads from root
Matt Mackall
mpm at selenic.com
Tue Dec 13 16:57:39 CST 2011
On Tue, 2011-12-13 at 00:52 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1323688511 -3600
> # Node ID e462a746b0dbe3eb1267701cd8bc74cdba21cb05
> # Parent 1bd92cc9496a217c06662431a2f3e3e8e0780a2a
> phases: add a function to compute heads from root
>
> diff --git a/mercurial/phases.py b/mercurial/phases.py
> --- a/mercurial/phases.py
> +++ b/mercurial/phases.py
> @@ -133,3 +133,31 @@
> return 1
> finally:
> lock.release()
> +
> +def analyseremotephases(repo, subset, roots):
Localization error. In en_us, we use 'analyze', 'serialize', etc.
> + """Compute phases heads and root in a subset of node from root dict
> +
> + * subset is heads of the subset
> + * roots is {<nodeid> => phase} mapping. key and value are string.
> + Accept unknown element input
> + """
> + # build list from dictionary
> + phaseroots = [[] for p in allphases]
[] * len(allphases)
> + for nhex, phase in roots.iteritems():
> + node = bin(nhex)
> + phase = int(phase)
> + if node in repo:
> + phaseroots[phase].append(node)
> + # remove potential nullid root added by pushkey
> + phaseroots[0] = []
> + # compute heads
> + phaseheads = [[] for p in allphases]
> + for phase in allphases[:-1]:
> + toproof = phaseroots[phase + 1]
> + #rvset = repo.set('(::%ln) - (%ln::)', subset, toproof)
Dead comment?
> + revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))',
> + subset, toproof, toproof, subset)
> + phaseheads[phase].extend(c.node() for c in revset)
> + return phaseheads, phaseroots
> +
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list