Patchwork [5,of,7,V4] clfilter: use filtering in `visibleheads`

mail settings
Submitter Pierre-Yves David
Date Dec. 20, 2012, 4:23 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/215/
State Accepted
Commit a2cebd3e4daaa0565733b75fa1275c497746e115
Headers show


Pierre-Yves David - Dec. 20, 2012, 4:23 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at>
# Date 1355761632 -3600
# Node ID 454e0d340af6677f9e6c96ed8f83f2cc4b79d49a
# Parent  f04dd8c07b2429876569eab9136160d5c9c98bd2
clfilter: use filtering in `visibleheads`

This is the second real use of changelog filtering. The change is very small to
allow testing the new filter with a setup close to the original one.

We replace custom post processing on `heads`function by call to the standard
code pass on a filtering repo.

In later coming will have wider usage of filtering that will make the dedicated
function useless.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -336,23 +336,11 @@  def checkheads(repo, remote, outgoing, r
     if unsynced:
         repo.ui.warn(_("note: unsynced remote changes!\n"))
 def visibleheads(repo):
     """return the set of visible head of this repo"""
-    # XXX we want a cache on this
-    sroots = repo._phasecache.phaseroots[phases.secret]
-    if sroots or repo.obsstore:
-        # XXX very slow revset. storing heads or secret "boundary"
-        # would help.
-        revset = repo.set('heads(not (%ln:: + extinct()))', sroots)
-        vheads = [ctx.node() for ctx in revset]
-        if not vheads:
-            vheads.append(nullid)
-    else:
-        vheads = repo.heads()
-    return vheads
+    return repo.filtered('unserved').heads()
 def visiblebranchmap(repo):
     """return a branchmap for the visible set"""
     return repo.filtered('unserved').branchmap()
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -89,11 +89,11 @@  check that mercurial refuse to push
   $ hg init ../other
   $ hg push ../other
   pushing to ../other
   searching for changes
-  abort: push includes divergent changeset: 82623d38b9ba!
+  abort: push includes divergent changeset: 392fd25390da!
   $ cd ..
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -174,10 +174,11 @@  the public changeset
 And that we can't push bumped changeset
   $ hg push ../tmpa -r 0 --force #(make repo related)
   pushing to ../tmpa
   searching for changes
+  warning: repository is unrelated
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   $ hg push ../tmpa