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.
--- a/mercurial/discovery.py Mon Dec 17 17:42:34 2012 +0100
+++ b/mercurial/discovery.py Mon Dec 17 17:27:12 2012 +0100
@@ -338,19 +338,7 @@
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):
--- a/tests/test-obsolete-divergent.t Mon Dec 17 17:42:34 2012 +0100
+++ b/tests/test-obsolete-divergent.t Mon Dec 17 17:27:12 2012 +0100
@@ -91,7 +91,7 @@
$ hg push ../other
pushing to ../other
searching for changes
- abort: push includes divergent changeset: 82623d38b9ba!
+ abort: push includes divergent changeset: 392fd25390da!
[255]
$ cd ..
--- a/tests/test-obsolete.t Mon Dec 17 17:42:34 2012 +0100
+++ b/tests/test-obsolete.t Mon Dec 17 17:27:12 2012 +0100
@@ -176,6 +176,7 @@
$ 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