# HG changeset patch # User Pierre-Yves David # Date 2012-12-17 16:27:12 # Node ID a2cebd3e4daaa0565733b75fa1275c497746e115 # Parent 83cb1a1a705d54f00d051faffea9c9969f48546c 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/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -338,19 +338,7 @@ def checkheads(repo, remote, outgoing, r 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): 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 @@ -91,7 +91,7 @@ check that mercurial refuse to push $ hg push ../other pushing to ../other searching for changes - abort: push includes divergent changeset: 82623d38b9ba! + abort: push includes divergent changeset: 392fd25390da! [255] $ cd .. diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -176,6 +176,7 @@ 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