changeset 50786:dde4b55a0785

wrapfunction: use sysstr instead of bytes as argument in "lfs" 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:23:12 +0100
parents bf92386f76fd
children 584fc92dd8d7
files hgext/lfs/__init__.py hgext/lfs/wireprotolfsserver.py hgext/lfs/wrapper.py
diffstat 3 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/lfs/__init__.py	Fri Feb 03 04:22:41 2023 +0100
+++ b/hgext/lfs/__init__.py	Fri Feb 03 04:23:12 2023 +0100
@@ -342,7 +342,7 @@
     wrapfunction(filelog, 'size', wrapper.filelogsize)
 
 
-@eh.wrapfunction(localrepo, b'resolverevlogstorevfsoptions')
+@eh.wrapfunction(localrepo, 'resolverevlogstorevfsoptions')
 def _resolverevlogstorevfsoptions(orig, ui, requirements, features):
     opts = orig(ui, requirements, features)
     for name, module in extensions.extensions(ui):
--- a/hgext/lfs/wireprotolfsserver.py	Fri Feb 03 04:22:41 2023 +0100
+++ b/hgext/lfs/wireprotolfsserver.py	Fri Feb 03 04:23:12 2023 +0100
@@ -33,7 +33,7 @@
 eh = exthelper.exthelper()
 
 
-@eh.wrapfunction(wireprotoserver, b'handlewsgirequest')
+@eh.wrapfunction(wireprotoserver, 'handlewsgirequest')
 def handlewsgirequest(orig, rctx, req, res, checkperm):
     """Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS
     request if it is left unprocessed by the wrapped method.
--- a/hgext/lfs/wrapper.py	Fri Feb 03 04:22:41 2023 +0100
+++ b/hgext/lfs/wrapper.py	Fri Feb 03 04:23:12 2023 +0100
@@ -53,7 +53,7 @@
 eh = exthelper.exthelper()
 
 
-@eh.wrapfunction(localrepo, b'makefilestorage')
+@eh.wrapfunction(localrepo, 'makefilestorage')
 def localrepomakefilestorage(orig, requirements, features, **kwargs):
     if b'lfs' in requirements:
         features.add(repository.REPO_FEATURE_LFS)
@@ -61,14 +61,14 @@
     return orig(requirements=requirements, features=features, **kwargs)
 
 
-@eh.wrapfunction(changegroup, b'allsupportedversions')
+@eh.wrapfunction(changegroup, 'allsupportedversions')
 def allsupportedversions(orig, ui):
     versions = orig(ui)
     versions.add(b'03')
     return versions
 
 
-@eh.wrapfunction(wireprotov1server, b'_capabilities')
+@eh.wrapfunction(wireprotov1server, '_capabilities')
 def _capabilities(orig, repo, proto):
     '''Wrap server command to announce lfs server capability'''
     caps = orig(repo, proto)
@@ -227,7 +227,7 @@
     return orig(self, rev)
 
 
-@eh.wrapfunction(revlog, b'_verify_revision')
+@eh.wrapfunction(revlog, '_verify_revision')
 def _verify_revision(orig, rl, skipflags, state, node):
     if _islfs(rl, node=node):
         rawtext = rl.rawdata(node)
@@ -246,7 +246,7 @@
     orig(rl, skipflags, state, node)
 
 
-@eh.wrapfunction(context.basefilectx, b'cmp')
+@eh.wrapfunction(context.basefilectx, 'cmp')
 def filectxcmp(orig, self, fctx):
     """returns True if text is different than fctx"""
     # some fctx (ex. hg-git) is not based on basefilectx and do not have islfs
@@ -258,7 +258,7 @@
     return orig(self, fctx)
 
 
-@eh.wrapfunction(context.basefilectx, b'isbinary')
+@eh.wrapfunction(context.basefilectx, 'isbinary')
 def filectxisbinary(orig, self):
     if self.islfs():
         # fast path: use lfs metadata to answer isbinary
@@ -272,13 +272,13 @@
     return _islfs(self.filelog()._revlog, self.filenode())
 
 
-@eh.wrapfunction(cmdutil, b'_updatecatformatter')
+@eh.wrapfunction(cmdutil, '_updatecatformatter')
 def _updatecatformatter(orig, fm, ctx, matcher, path, decode):
     orig(fm, ctx, matcher, path, decode)
     fm.data(rawdata=ctx[path].rawdata())
 
 
-@eh.wrapfunction(scmutil, b'wrapconvertsink')
+@eh.wrapfunction(scmutil, 'wrapconvertsink')
 def convertsink(orig, sink):
     sink = orig(sink)
     if sink.repotype == b'hg':
@@ -325,7 +325,7 @@
 
 # bundlerepo uses "vfsmod.readonlyvfs(othervfs)", we need to make sure lfs
 # options and blob stores are passed from othervfs to the new readonlyvfs.
-@eh.wrapfunction(vfsmod.readonlyvfs, b'__init__')
+@eh.wrapfunction(vfsmod.readonlyvfs, '__init__')
 def vfsinit(orig, self, othervfs):
     orig(self, othervfs)
     # copy lfs related options
@@ -403,7 +403,7 @@
     return uploadblobsfromrevs(pushop.repo, pushop.outgoing.missing)
 
 
-@eh.wrapfunction(exchange, b'push')
+@eh.wrapfunction(exchange, 'push')
 def push(orig, repo, remote, *args, **kwargs):
     """bail on push if the extension isn't enabled on remote when needed, and
     update the remote store based on the destination path."""
@@ -433,7 +433,7 @@
 
 
 # when writing a bundle via "hg bundle" command, upload related LFS blobs
-@eh.wrapfunction(bundle2, b'writenewbundle')
+@eh.wrapfunction(bundle2, 'writenewbundle')
 def writenewbundle(
     orig, ui, repo, source, filename, bundletype, outgoing, *args, **kwargs
 ):
@@ -522,7 +522,7 @@
     remoteblob.writebatch(pointers, repo.svfs.lfslocalblobstore)
 
 
-@eh.wrapfunction(upgrade_engine, b'finishdatamigration')
+@eh.wrapfunction(upgrade_engine, 'finishdatamigration')
 def upgradefinishdatamigration(orig, ui, srcrepo, dstrepo, requirements):
     orig(ui, srcrepo, dstrepo, requirements)
 
@@ -539,8 +539,8 @@
                 lfutil.link(srclfsvfs.join(oid), dstlfsvfs.join(oid))
 
 
-@eh.wrapfunction(upgrade_actions, b'preservedrequirements')
-@eh.wrapfunction(upgrade_actions, b'supporteddestrequirements')
+@eh.wrapfunction(upgrade_actions, 'preservedrequirements')
+@eh.wrapfunction(upgrade_actions, 'supporteddestrequirements')
 def upgraderequirements(orig, repo):
     reqs = orig(repo)
     if b'lfs' in repo.requirements: