[PATCH 4 of 6] phase: extracts heads computation logics from analyzeremotephases

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jan 20 14:30:56 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1327083833 -3600
# Branch stable
# Node ID 5989cd1e37ab11526c336d32ccd395c087e05792
# Parent  c70421e2c2cf21eac8e37fd46bf3cc35b9bde856
phase: extracts heads computation logics from analyzeremotephases

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -285,8 +285,15 @@
             msg = _('ignoring unexpected root from remote: %i %s\n')
             repo.ui.warn(msg % (phase, nhex))
     # compute heads
-    revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))',
-                      subset, draftroots, draftroots, subset)
-    publicheads = [c.node() for c in revset]
+    publicheads = newheads(repo, subset, draftroots)
     return publicheads, draftroots
 
+def newheads(repo, heads, roots):
+    """compute new head of a subset minus another
+
+    * `heads`: define the first subset
+    * `rroots`: define the second we substract to the first"""
+    revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))',
+                      heads, roots, roots, heads)
+    return [c.node() for c in revset]
+


More information about the Mercurial-devel mailing list