diff --git a/remotefilelog/__init__.py b/remotefilelog/__init__.py --- a/remotefilelog/__init__.py +++ b/remotefilelog/__init__.py @@ -152,7 +152,8 @@ # Replace remote.stream_out with a version that sends file # patterns. def stream_out_shallow(orig): - if shallowrepo.requirement in remote._capabilities(): + caps = shallowutil.peercapabilities(remote) + if shallowrepo.requirement in caps: opts = {} if repo.includepattern: opts['includepattern'] = '\0'.join(repo.includepattern) diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py --- a/remotefilelog/fileserverclient.py +++ b/remotefilelog/fileserverclient.py @@ -64,7 +64,7 @@ def _updatecallstreamopts(self, command, opts): if command != 'getbundle': return - if 'remotefilelog' not in self._capabilities(): + if 'remotefilelog' not in shallowutil.peercapabilities(self): return if not util.safehasattr(self, '_localrepo'): return diff --git a/remotefilelog/remotefilelogserver.py b/remotefilelog/remotefilelogserver.py --- a/remotefilelog/remotefilelogserver.py +++ b/remotefilelog/remotefilelogserver.py @@ -193,7 +193,11 @@ caps.append('getflogheads') caps.append('getfile') return caps - wrapfunction(wireproto, '_capabilities', _capabilities) + if util.safehasattr(wireproto, '_capabilities'): + wrapfunction(wireproto, '_capabilities', _capabilities) + else: + # renamed by upstream 1f8460b55986d405a3a6dff1597c4dbad072e7da + wrapfunction(wireproto, 'capabilities', _capabilities) def _adjustlinkrev(orig, self, *args, **kwargs): # When generating file blobs, taking the real path is too slow on large diff --git a/remotefilelog/shallowutil.py b/remotefilelog/shallowutil.py --- a/remotefilelog/shallowutil.py +++ b/remotefilelog/shallowutil.py @@ -463,3 +463,6 @@ setstickygroupdir(path, gid, ui.warn) finally: os.umask(oldumask) + +def peercapabilities(peer): + return getattr(peer, '_capabilities', getattr(peer, 'capabilities'))()