changeset 50826:cbd1da102417

wrapfunction: use sysstr instead of bytes as argument in "remotefilelog" This is as valid and simpler, it will help us to eventually get ride of `safehasattr`.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 03 Feb 2023 04:25:07 +0100
parents 05430a06a2eb
children 5ac5f16277a9
files hgext/remotefilelog/__init__.py hgext/remotefilelog/remotefilelogserver.py
diffstat 2 files changed, 29 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/__init__.py	Fri Feb 03 04:24:53 2023 +0100
+++ b/hgext/remotefilelog/__init__.py	Fri Feb 03 04:25:07 2023 +0100
@@ -317,31 +317,31 @@
     changegroup.cgpacker = shallowbundle.shallowcg1packer
 
     extensions.wrapfunction(
-        changegroup, b'_addchangegroupfiles', shallowbundle.addchangegroupfiles
+        changegroup, '_addchangegroupfiles', shallowbundle.addchangegroupfiles
     )
     extensions.wrapfunction(
-        changegroup, b'makechangegroup', shallowbundle.makechangegroup
+        changegroup, 'makechangegroup', shallowbundle.makechangegroup
     )
-    extensions.wrapfunction(localrepo, b'makestore', storewrapper)
-    extensions.wrapfunction(exchange, b'pull', exchangepull)
-    extensions.wrapfunction(merge, b'applyupdates', applyupdates)
-    extensions.wrapfunction(merge, b'_checkunknownfiles', checkunknownfiles)
-    extensions.wrapfunction(context.workingctx, b'_checklookup', checklookup)
-    extensions.wrapfunction(scmutil, b'_findrenames', findrenames)
+    extensions.wrapfunction(localrepo, 'makestore', storewrapper)
+    extensions.wrapfunction(exchange, 'pull', exchangepull)
+    extensions.wrapfunction(merge, 'applyupdates', applyupdates)
+    extensions.wrapfunction(merge, '_checkunknownfiles', checkunknownfiles)
+    extensions.wrapfunction(context.workingctx, '_checklookup', checklookup)
+    extensions.wrapfunction(scmutil, '_findrenames', findrenames)
     extensions.wrapfunction(
-        copies, b'_computeforwardmissing', computeforwardmissing
+        copies, '_computeforwardmissing', computeforwardmissing
     )
-    extensions.wrapfunction(dispatch, b'runcommand', runcommand)
-    extensions.wrapfunction(repair, b'_collectbrokencsets', _collectbrokencsets)
-    extensions.wrapfunction(context.changectx, b'filectx', filectx)
-    extensions.wrapfunction(context.workingctx, b'filectx', workingfilectx)
-    extensions.wrapfunction(patch, b'trydiff', trydiff)
-    extensions.wrapfunction(hg, b'verify', _verify)
+    extensions.wrapfunction(dispatch, 'runcommand', runcommand)
+    extensions.wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets)
+    extensions.wrapfunction(context.changectx, 'filectx', filectx)
+    extensions.wrapfunction(context.workingctx, 'filectx', workingfilectx)
+    extensions.wrapfunction(patch, 'trydiff', trydiff)
+    extensions.wrapfunction(hg, 'verify', _verify)
     scmutil.fileprefetchhooks.add(b'remotefilelog', _fileprefetchhook)
 
     # disappointing hacks below
-    extensions.wrapfunction(scmutil, b'getrenamedfn', getrenamedfn)
-    extensions.wrapfunction(revset, b'filelog', filelogrevset)
+    extensions.wrapfunction(scmutil, 'getrenamedfn', getrenamedfn)
+    extensions.wrapfunction(revset, 'filelog', filelogrevset)
     revset.symbols[b'filelog'] = revset.filelog
 
 
@@ -374,7 +374,7 @@
             else:
                 return orig(self, *args, **kwargs)
 
-        extensions.wrapfunction(exchange, b'pull', pull_shallow)
+        extensions.wrapfunction(exchange, 'pull', pull_shallow)
 
         # Wrap the stream logic to add requirements and to pass include/exclude
         # patterns around.
@@ -393,14 +393,14 @@
                 else:
                     return orig()
 
-            extensions.wrapfunction(remote, b'stream_out', stream_out_shallow)
+            extensions.wrapfunction(remote, 'stream_out', stream_out_shallow)
 
         def stream_wrap(orig, op):
             setup_streamout(op.repo, op.remote)
             return orig(op)
 
         extensions.wrapfunction(
-            streamclone, b'maybeperformlegacystreamclone', stream_wrap
+            streamclone, 'maybeperformlegacystreamclone', stream_wrap
         )
 
         def canperformstreamclone(orig, pullop, bundle2=False):
@@ -417,7 +417,7 @@
             return supported, requirements
 
         extensions.wrapfunction(
-            streamclone, b'canperformstreamclone', canperformstreamclone
+            streamclone, 'canperformstreamclone', canperformstreamclone
         )
 
     try:
@@ -721,7 +721,7 @@
             )
 
     extensions.wrapfunction(
-        remotefilelog.remotefilelog, b'addrawrevision', addrawrevision
+        remotefilelog.remotefilelog, 'addrawrevision', addrawrevision
     )
 
     def changelogadd(orig, self, *args, **kwargs):
@@ -749,7 +749,7 @@
         del pendingfilecommits[:]
         return node
 
-    extensions.wrapfunction(changelog.changelog, b'add', changelogadd)
+    extensions.wrapfunction(changelog.changelog, 'add', changelogadd)
 
 
 def getrenamedfn(orig, repo, endrev=None):
@@ -1083,7 +1083,7 @@
     if util.safehasattr(remote, b'_callstream'):
         remote._localrepo = repo
     elif util.safehasattr(remote, b'getbundle'):
-        extensions.wrapfunction(remote, b'getbundle', localgetbundle)
+        extensions.wrapfunction(remote, 'getbundle', localgetbundle)
 
     return orig(repo, remote, *args, **kwargs)
 
--- a/hgext/remotefilelog/remotefilelogserver.py	Fri Feb 03 04:24:53 2023 +0100
+++ b/hgext/remotefilelog/remotefilelogserver.py	Fri Feb 03 04:25:07 2023 +0100
@@ -67,7 +67,7 @@
         )
 
     extensions.wrapfunction(
-        changegroup.cgpacker, b'generatefiles', generatefiles
+        changegroup.cgpacker, 'generatefiles', generatefiles
     )
 
 
@@ -207,7 +207,7 @@
             ):
                 yield x
 
-    extensions.wrapfunction(streamclone, b'_walkstreamfiles', _walkstreamfiles)
+    extensions.wrapfunction(streamclone, '_walkstreamfiles', _walkstreamfiles)
 
     # expose remotefilelog capabilities
     def _capabilities(orig, repo, proto):
@@ -222,7 +222,7 @@
             caps.append(b'x_rfl_getfile')
         return caps
 
-    extensions.wrapfunction(wireprotov1server, b'_capabilities', _capabilities)
+    extensions.wrapfunction(wireprotov1server, '_capabilities', _capabilities)
 
     def _adjustlinkrev(orig, self, *args, **kwargs):
         # When generating file blobs, taking the real path is too slow on large
@@ -233,7 +233,7 @@
         return orig(self, *args, **kwargs)
 
     extensions.wrapfunction(
-        context.basefilectx, b'_adjustlinkrev', _adjustlinkrev
+        context.basefilectx, '_adjustlinkrev', _adjustlinkrev
     )
 
     def _iscmd(orig, cmd):
@@ -241,7 +241,7 @@
             return False
         return orig(cmd)
 
-    extensions.wrapfunction(wireprotoserver, b'iscmd', _iscmd)
+    extensions.wrapfunction(wireprotoserver, 'iscmd', _iscmd)
 
 
 def _loadfileblob(repo, cachepath, path, node):