diff hgext/fastannotate/protocol.py @ 39241:303dae0136b0

fastannotate: rip out specialized support for remotefilelog remotefilelog can choose to collaborate with fastannotate for now if it needs to, and in the future when we make good on our longstanding desire to move remotefilelog-like features in-house we'll make sure things are well-supported via a reasonable interface. Differential Revision: https://phab.mercurial-scm.org/D4201
author Augie Fackler <augie@google.com>
date Thu, 09 Aug 2018 15:05:43 -0400
parents c8a40b33ce30
children 8da20fc9fc07
line wrap: on
line diff
--- a/hgext/fastannotate/protocol.py	Thu Aug 09 14:56:29 2018 -0400
+++ b/hgext/fastannotate/protocol.py	Thu Aug 09 15:05:43 2018 -0400
@@ -134,33 +134,14 @@
 def annotatepeer(repo):
     ui = repo.ui
 
-    # fileservice belongs to remotefilelog
-    fileservice = getattr(repo, 'fileservice', None)
-    sharepeer = ui.configbool('fastannotate', 'clientsharepeer', True)
-
-    if sharepeer and fileservice:
-        ui.debug('fastannotate: using remotefilelog connection pool\n')
-        conn = repo.connectionpool.get(repo.fallbackpath)
-        peer = conn.peer
-        stolen = True
-    else:
-        remotepath = ui.expandpath(
-            ui.config('fastannotate', 'remotepath', 'default'))
-        peer = hg.peer(ui, {}, remotepath)
-        stolen = False
+    remotepath = ui.expandpath(
+        ui.config('fastannotate', 'remotepath', 'default'))
+    peer = hg.peer(ui, {}, remotepath)
 
     try:
-        # Note: fastannotate requests should never trigger a remotefilelog
-        # "getfiles" request, because "getfiles" puts the stream into a state
-        # that does not exit. See "clientfetch": it does "getannotate" before
-        # any hg stuff that could potentially trigger a "getfiles".
         yield peer
     finally:
-        if not stolen:
-            for i in ['close', 'cleanup']:
-                getattr(peer, i, lambda: None)()
-        else:
-            conn.__exit__(None, None, None)
+        peer.close()
 
 def clientfetch(repo, paths, lastnodemap=None, peer=None):
     """download annotate cache from the server for paths"""
@@ -209,16 +190,10 @@
 
     master = repo.ui.config('fastannotate', 'mainbranch') or 'default'
 
-    if 'remotefilelog' in repo.requirements:
-        ctx = scmutil.revsingle(repo, master)
-        f = lambda path: len(ctx[path].ancestormap())
-    else:
-        f = lambda path: len(repo.file(path))
-
     result = []
     for path in paths:
         try:
-            if f(path) >= threshold:
+            if len(repo.file(path)) >= threshold:
                 result.append(path)
         except Exception: # file not found etc.
             result.append(path)