[PATCH 4 of 7 Series-C] clfilter: drop extra filtering in wireprotocol

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Jan 7 12:16:07 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1357443390 -3600
# Node ID aad94e8108f165784cb9765a128b537689c692dd
# Parent  3d3f81458983d5d8d577ad0b17840ec952f609b3
clfilter: drop extra filtering in wireprotocol

The repository used by wireprotocol is already filtered. We do not need to call
special function anymore.

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -8,11 +8,10 @@
 import urllib, tempfile, os, sys
 from i18n import _
 from node import bin, hex
 import changegroup as changegroupmod
 import peer, error, encoding, util, store
-import discovery, phases
 
 # abstract batching support
 
 class future(object):
     '''placeholder for a value to be set later'''
@@ -399,11 +398,11 @@ def between(repo, proto, pairs):
     for b in repo.between(pairs):
         r.append(encodelist(b) + "\n")
     return "".join(r)
 
 def branchmap(repo, proto):
-    branchmap = discovery.visiblebranchmap(repo)
+    branchmap = repo.branchmap()
     heads = []
     for branch, nodes in branchmap.iteritems():
         branchname = urllib.quote(encoding.fromlocal(branch))
         branchnodes = encodelist(nodes)
         heads.append('%s %s' % (branchname, branchnodes))
@@ -455,11 +454,11 @@ def getbundle(repo, proto, others):
         opts[k] = decodelist(v)
     cg = repo.getbundle('serve', **opts)
     return streamres(proto.groupchunks(cg))
 
 def heads(repo, proto):
-    h = discovery.visibleheads(repo)
+    h = repo.heads()
     return encodelist(h) + "\n"
 
 def hello(repo, proto):
     '''the hello command returns a set of lines describing various
     interesting things about the server, in an RFC822-like format.
@@ -478,12 +477,10 @@ def listkeys(repo, proto, namespace):
 
 def lookup(repo, proto, key):
     try:
         k = encoding.tolocal(key)
         c = repo[k]
-        if c.phase() == phases.secret:
-            raise error.RepoLookupError(_("unknown revision '%s'") % k)
         r = c.hex()
         success = 1
     except Exception, inst:
         r = str(inst)
         success = 0
@@ -593,11 +590,11 @@ def stream(repo, proto):
 
 def unbundle(repo, proto, heads):
     their_heads = decodelist(heads)
 
     def check_heads():
-        heads = discovery.visibleheads(repo)
+        heads = repo.heads()
         heads_hash = util.sha1(''.join(sorted(heads))).digest()
         return (their_heads == ['force'] or their_heads == heads or
                 their_heads == ['hashed', heads_hash])
 
     proto.redirect()


More information about the Mercurial-devel mailing list