phase: extracts heads computation logics from analyzeremotephases stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 20 Jan 2012 19:23:53 +0100
branchstable
changeset 15954 b345f851d056
parent 15953 52dc2b33d0be
child 15955 5a14f48d6b9a
phase: extracts heads computation logics from analyzeremotephases
mercurial/phases.py
--- a/mercurial/phases.py	Fri Jan 20 19:18:09 2012 +0100
+++ b/mercurial/phases.py	Fri Jan 20 19:23:53 2012 +0100
@@ -285,8 +285,15 @@
             repo.ui.warn(_('ignoring unexpected root from remote: %i %s\n')
                          % (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]
+