localpeer: return only visible heads and branchmap
Now that we have localpeer, we can apply filtering on heads and branchmap the
same way it's done for wireprotocol peer.
--- a/mercurial/discovery.py Wed Jul 18 14:41:58 2012 +0200
+++ b/mercurial/discovery.py Tue Jul 17 01:04:45 2012 +0200
@@ -168,10 +168,7 @@
branches = set(repo[n].branch() for n in outgoing.missing)
# 2. Check for new branches on the remote.
- if remote.local():
- remotemap = phases.visiblebranchmap(remote.local())
- else:
- remotemap = remote.branchmap()
+ remotemap = remote.branchmap()
newbranches = branches - set(remotemap)
if newbranches and not newbranch: # new branch requires --new-branch
branchnames = ', '.join(sorted(newbranches))
--- a/mercurial/localrepo.py Wed Jul 18 14:41:58 2012 +0200
+++ b/mercurial/localrepo.py Tue Jul 17 01:04:45 2012 +0200
@@ -56,10 +56,10 @@
return self._repo.lookup(key)
def branchmap(self):
- return self._repo.branchmap()
+ return phases.visiblebranchmap(self._repo)
def heads(self):
- return self._repo.heads()
+ return phases.visibleheads(self._repo)
def known(self, nodes):
return self._repo.known(nodes)
--- a/mercurial/setdiscovery.py Wed Jul 18 14:41:58 2012 +0200
+++ b/mercurial/setdiscovery.py Tue Jul 17 01:04:45 2012 +0200
@@ -9,7 +9,6 @@
from node import nullid
from i18n import _
import random, util, dagutil
-import phases
def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
# if nodes is empty we scan the entire graph
@@ -100,7 +99,7 @@
sample = ownheads
if remote.local():
# stopgap until we have a proper localpeer that supports batch()
- srvheadhashes = phases.visibleheads(remote.local())
+ srvheadhashes = remote.heads()
yesno = remote.known(dag.externalizeall(sample))
elif remote.capable('batch'):
batch = remote.batch()