remotefilelog: use sysstr to check for attribute presence
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 30 Aug 2023 13:07:00 +0200
changeset 50895 a834ec41f17c
parent 50894 f75fd677cc05
child 50896 b2b8c25f9462
remotefilelog: use sysstr to check for attribute presence We do not need bytes here.
hgext/remotefilelog/__init__.py
hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/__init__.py	Wed Aug 30 13:02:43 2023 +0200
+++ b/hgext/remotefilelog/__init__.py	Wed Aug 30 13:07:00 2023 +0200
@@ -425,7 +425,7 @@
     finally:
         if opts.get('shallow'):
             for r in repos:
-                if util.safehasattr(r, b'fileservice'):
+                if util.safehasattr(r, 'fileservice'):
                     r.fileservice.close()
 
 
@@ -904,7 +904,7 @@
         if not isenabled(repo):
             continue
 
-        if not util.safehasattr(repo, b'name'):
+        if not util.safehasattr(repo, 'name'):
             ui.warn(
                 _(b"repo %s is a misconfigured remotefilelog repo\n") % path
             )
@@ -1034,7 +1034,7 @@
     bgprefetchrevs = revdatelimit(ui, bgprefetchrevs)
 
     def anon(unused_success):
-        if util.safehasattr(repo, b'ranprefetch') and repo.ranprefetch:
+        if util.safehasattr(repo, 'ranprefetch') and repo.ranprefetch:
             return
         repo.ranprefetch = True
         repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack)
@@ -1080,9 +1080,9 @@
             source, heads=heads, common=common, bundlecaps=bundlecaps, **kwargs
         )
 
-    if util.safehasattr(remote, b'_callstream'):
+    if util.safehasattr(remote, '_callstream'):
         remote._localrepo = repo
-    elif util.safehasattr(remote, b'getbundle'):
+    elif util.safehasattr(remote, 'getbundle'):
         extensions.wrapfunction(remote, 'getbundle', localgetbundle)
 
     return orig(repo, remote, *args, **kwargs)
--- a/hgext/remotefilelog/remotefilelogserver.py	Wed Aug 30 13:02:43 2023 +0200
+++ b/hgext/remotefilelog/remotefilelogserver.py	Wed Aug 30 13:07:00 2023 +0200
@@ -228,7 +228,7 @@
         # When generating file blobs, taking the real path is too slow on large
         # repos, so force it to just return the linkrev directly.
         repo = self._repo
-        if util.safehasattr(repo, b'forcelinkrev') and repo.forcelinkrev:
+        if util.safehasattr(repo, 'forcelinkrev') and repo.forcelinkrev:
             return self._filelog.linkrev(self._filelog.rev(self._filenode))
         return orig(self, *args, **kwargs)