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

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 7, 2013, 6:16 p.m.
Message ID <aad94e8108f165784cb9.1357582567@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/481/
State Accepted
Commit 898c575833c965d8c4ca5004f57a7989fa2eefb4
Headers show

Comments

Pierre-Yves David - Jan. 7, 2013, 6:16 p.m.
# 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.

Patch

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()