D4201: fastannotate: rip out specialized support for remotefilelog

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Aug 9 19:13:38 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4201

AFFECTED FILES
  hgext/fastannotate/__init__.py
  hgext/fastannotate/protocol.py
  hgext/fastannotate/support.py

CHANGE DETAILS

diff --git a/hgext/fastannotate/support.py b/hgext/fastannotate/support.py
--- a/hgext/fastannotate/support.py
+++ b/hgext/fastannotate/support.py
@@ -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)
diff --git a/hgext/fastannotate/protocol.py b/hgext/fastannotate/protocol.py
--- a/hgext/fastannotate/protocol.py
+++ b/hgext/fastannotate/protocol.py
@@ -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)
diff --git a/hgext/fastannotate/__init__.py b/hgext/fastannotate/__init__.py
--- a/hgext/fastannotate/__init__.py
+++ b/hgext/fastannotate/__init__.py
@@ -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,15 +142,14 @@
 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)
 configitem('fastannotate', 'mainbranch')
 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)



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list