diff hgext/lfs/wrapper.py @ 50901:6543469a351e

lfs: use sysstr to check for attribute presence We do not need bytes here.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 30 Aug 2023 12:51:27 +0200
parents 609a3b8058c3
children d718eddf01d9
line wrap: on
line diff
--- a/hgext/lfs/wrapper.py	Wed Aug 30 12:38:02 2023 +0200
+++ b/hgext/lfs/wrapper.py	Wed Aug 30 12:51:27 2023 +0200
@@ -72,7 +72,7 @@
 def _capabilities(orig, repo, proto):
     '''Wrap server command to announce lfs server capability'''
     caps = orig(repo, proto)
-    if util.safehasattr(repo.svfs, b'lfslocalblobstore'):
+    if util.safehasattr(repo.svfs, 'lfslocalblobstore'):
         # Advertise a slightly different capability when lfs is *required*, so
         # that the client knows it MUST load the extension.  If lfs is not
         # required on the server, there's no reason to autoload the extension
@@ -334,7 +334,7 @@
             self.options[k] = v
     # also copy lfs blobstores. note: this can run before reposetup, so lfs
     # blobstore attributes are not always ready at this time.
-    for name in [b'lfslocalblobstore', b'lfsremoteblobstore']:
+    for name in ['lfslocalblobstore', 'lfsremoteblobstore']:
         if util.safehasattr(othervfs, name):
             setattr(self, name, getattr(othervfs, name))
 
@@ -342,7 +342,7 @@
 def _prefetchfiles(repo, revmatches):
     """Ensure that required LFS blobs are present, fetching them as a group if
     needed."""
-    if not util.safehasattr(repo.svfs, b'lfslocalblobstore'):
+    if not util.safehasattr(repo.svfs, 'lfslocalblobstore'):
         return
 
     pointers = []
@@ -366,7 +366,7 @@
 
 def _canskipupload(repo):
     # Skip if this hasn't been passed to reposetup()
-    if not util.safehasattr(repo.svfs, b'lfsremoteblobstore'):
+    if not util.safehasattr(repo.svfs, 'lfsremoteblobstore'):
         return True
 
     # if remotestore is a null store, upload is a no-op and can be skipped
@@ -375,7 +375,7 @@
 
 def candownload(repo):
     # Skip if this hasn't been passed to reposetup()
-    if not util.safehasattr(repo.svfs, b'lfsremoteblobstore'):
+    if not util.safehasattr(repo.svfs, 'lfsremoteblobstore'):
         return False
 
     # if remotestore is a null store, downloads will lead to nothing
@@ -524,9 +524,9 @@
     orig(ui, srcrepo, dstrepo, requirements)
 
     # Skip if this hasn't been passed to reposetup()
-    if util.safehasattr(
-        srcrepo.svfs, b'lfslocalblobstore'
-    ) and util.safehasattr(dstrepo.svfs, b'lfslocalblobstore'):
+    if util.safehasattr(srcrepo.svfs, 'lfslocalblobstore') and util.safehasattr(
+        dstrepo.svfs, 'lfslocalblobstore'
+    ):
         srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs
         dstlfsvfs = dstrepo.svfs.lfslocalblobstore.vfs