[PATCH 7 of 7 clfilter part 1 V3] clfilter: use filtering in `visibleheads`
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Mon Dec 17 16:50:16 UTC 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1355761632 -3600
# Node ID bc42773b7cfa991eee053f964e7133010b3f0a42
# Parent 9f84ba46fe34cf9d8d5b80f3a799208946680585
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
@@ -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!
[255]
$ 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
More information about the Mercurial-devel
mailing list