changeset 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 ca053fc7efc5
children 8da20fc9fc07
files hgext/fastannotate/__init__.py hgext/fastannotate/protocol.py hgext/fastannotate/support.py
diffstat 3 files changed, 8 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fastannotate/__init__.py	Thu Aug 09 14:56:29 2018 -0400
+++ b/hgext/fastannotate/__init__.py	Thu Aug 09 15:05:43 2018 -0400
@@ -53,19 +53,11 @@
     serverbuildondemand = True
 
     # update local annotate cache from remote on demand
-    # (default: True for remotefilelog repo, False otherwise)
-    client = True
+    client = False
 
     # path to use when connecting to the remote server (default: default)
     remotepath = default
 
-    # share sshpeer with remotefilelog. this would allow fastannotate to peek
-    # into remotefilelog internals, and steal its sshpeer, or in the reversed
-    # direction: donate its sshpeer to remotefilelog. disable this if
-    # fastannotate and remotefilelog should not share a sshpeer when their
-    # endpoints are different and incompatible. (default: True)
-    clientsharepeer = True
-
     # minimal length of the history of a file required to fetch linelog from
     # the server. (default: 10)
     clientfetchthreshold = 10
@@ -108,12 +100,8 @@
 #
 # * rename the config knob for updating the local cache from a remote server
 #
-# * remove the remotefilelog-peer-sharing functionality
-#
 # * move various global-setup bits to extsetup() or reposetup()
 #
-# * assume repo.requirements will always exist
-#
 # * move `flock` based locking to a common area
 #
 # * revise wireprotocol for sharing annotate files
@@ -154,7 +142,7 @@
 configitem('fastannotate', 'modes', default=['fastannotate'])
 configitem('fastannotate', 'server', default=False)
 configitem('fastannotate', 'useflock', default=True)
-configitem('fastannotate', 'client')
+configitem('fastannotate', 'client', default=False)
 configitem('fastannotate', 'unfilteredrepo', default=True)
 configitem('fastannotate', 'defaultformat', default=['number'])
 configitem('fastannotate', 'perfhack', default=False)
@@ -162,7 +150,6 @@
 configitem('fastannotate', 'forcetext', default=True)
 configitem('fastannotate', 'forcefollow', default=True)
 configitem('fastannotate', 'clientfetchthreshold', default=10)
-configitem('fastannotate', 'clientsharepeer', default=True)
 configitem('fastannotate', 'serverbuildondemand', default=True)
 configitem('fastannotate', 'remotepath', default='default')
 
@@ -188,7 +175,6 @@
         elif name == 'fctx':
             from . import support
             support.replacefctxannotate()
-            support.replaceremotefctxannotate()
             commands.wrapdefault()
         else:
             raise hgerror.Abort(_('fastannotate: invalid mode: %s') % name)
@@ -203,9 +189,5 @@
     localrepo.localrepository._wlockfreeprefix.add('fastannotate/')
 
 def reposetup(ui, repo):
-    client = ui.configbool('fastannotate', 'client', default=None)
-    if client is None:
-        if util.safehasattr(repo, 'requirements'):
-            client = 'remotefilelog' in repo.requirements
-    if client:
+    if ui.configbool('fastannotate', 'client'):
         protocol.clientreposetup(ui, repo)
--- 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)
--- a/hgext/fastannotate/support.py	Thu Aug 09 14:56:29 2018 -0400
+++ b/hgext/fastannotate/support.py	Thu Aug 09 15:05:43 2018 -0400
@@ -120,12 +120,3 @@
 
 def replacefctxannotate():
     extensions.wrapfunction(hgcontext.basefilectx, 'annotate', _fctxannotate)
-
-def replaceremotefctxannotate():
-    try:
-        r = extensions.find('remotefilelog')
-    except KeyError:
-        return
-    else:
-        extensions.wrapfunction(r.remotefilectx.remotefilectx, 'annotate',
-                                _remotefctxannotate)