##// END OF EJS Templates
lfs: use sysstr to check for attribute presence...
marmoute -
r51794:6543469a default
parent child Browse files
Show More
@@ -271,7 +271,7 b' def _urlerrorreason(urlerror):'
271 if isinstance(urlerror.reason, Exception):
271 if isinstance(urlerror.reason, Exception):
272 inst = urlerror.reason
272 inst = urlerror.reason
273
273
274 if util.safehasattr(inst, b'reason'):
274 if util.safehasattr(inst, 'reason'):
275 try: # usually it is in the form (errno, strerror)
275 try: # usually it is in the form (errno, strerror)
276 reason = inst.reason.args[1]
276 reason = inst.reason.args[1]
277 except (AttributeError, IndexError):
277 except (AttributeError, IndexError):
@@ -751,7 +751,7 b' def remote(repo, remote=None):'
751 if lfsurl is None:
751 if lfsurl is None:
752 if remote:
752 if remote:
753 path = remote
753 path = remote
754 elif util.safehasattr(repo, b'_subtoppath'):
754 elif util.safehasattr(repo, '_subtoppath'):
755 # The pull command sets this during the optional update phase, which
755 # The pull command sets this during the optional update phase, which
756 # tells exactly where the pull originated, whether 'paths.default'
756 # tells exactly where the pull originated, whether 'paths.default'
757 # or explicit.
757 # or explicit.
@@ -72,7 +72,7 b' def allsupportedversions(orig, ui):'
72 def _capabilities(orig, repo, proto):
72 def _capabilities(orig, repo, proto):
73 '''Wrap server command to announce lfs server capability'''
73 '''Wrap server command to announce lfs server capability'''
74 caps = orig(repo, proto)
74 caps = orig(repo, proto)
75 if util.safehasattr(repo.svfs, b'lfslocalblobstore'):
75 if util.safehasattr(repo.svfs, 'lfslocalblobstore'):
76 # Advertise a slightly different capability when lfs is *required*, so
76 # Advertise a slightly different capability when lfs is *required*, so
77 # that the client knows it MUST load the extension. If lfs is not
77 # that the client knows it MUST load the extension. If lfs is not
78 # required on the server, there's no reason to autoload the extension
78 # required on the server, there's no reason to autoload the extension
@@ -334,7 +334,7 b' def vfsinit(orig, self, othervfs):'
334 self.options[k] = v
334 self.options[k] = v
335 # also copy lfs blobstores. note: this can run before reposetup, so lfs
335 # also copy lfs blobstores. note: this can run before reposetup, so lfs
336 # blobstore attributes are not always ready at this time.
336 # blobstore attributes are not always ready at this time.
337 for name in [b'lfslocalblobstore', b'lfsremoteblobstore']:
337 for name in ['lfslocalblobstore', 'lfsremoteblobstore']:
338 if util.safehasattr(othervfs, name):
338 if util.safehasattr(othervfs, name):
339 setattr(self, name, getattr(othervfs, name))
339 setattr(self, name, getattr(othervfs, name))
340
340
@@ -342,7 +342,7 b' def vfsinit(orig, self, othervfs):'
342 def _prefetchfiles(repo, revmatches):
342 def _prefetchfiles(repo, revmatches):
343 """Ensure that required LFS blobs are present, fetching them as a group if
343 """Ensure that required LFS blobs are present, fetching them as a group if
344 needed."""
344 needed."""
345 if not util.safehasattr(repo.svfs, b'lfslocalblobstore'):
345 if not util.safehasattr(repo.svfs, 'lfslocalblobstore'):
346 return
346 return
347
347
348 pointers = []
348 pointers = []
@@ -366,7 +366,7 b' def _prefetchfiles(repo, revmatches):'
366
366
367 def _canskipupload(repo):
367 def _canskipupload(repo):
368 # Skip if this hasn't been passed to reposetup()
368 # Skip if this hasn't been passed to reposetup()
369 if not util.safehasattr(repo.svfs, b'lfsremoteblobstore'):
369 if not util.safehasattr(repo.svfs, 'lfsremoteblobstore'):
370 return True
370 return True
371
371
372 # if remotestore is a null store, upload is a no-op and can be skipped
372 # if remotestore is a null store, upload is a no-op and can be skipped
@@ -375,7 +375,7 b' def _canskipupload(repo):'
375
375
376 def candownload(repo):
376 def candownload(repo):
377 # Skip if this hasn't been passed to reposetup()
377 # Skip if this hasn't been passed to reposetup()
378 if not util.safehasattr(repo.svfs, b'lfsremoteblobstore'):
378 if not util.safehasattr(repo.svfs, 'lfsremoteblobstore'):
379 return False
379 return False
380
380
381 # if remotestore is a null store, downloads will lead to nothing
381 # if remotestore is a null store, downloads will lead to nothing
@@ -524,9 +524,9 b' def upgradefinishdatamigration(orig, ui,'
524 orig(ui, srcrepo, dstrepo, requirements)
524 orig(ui, srcrepo, dstrepo, requirements)
525
525
526 # Skip if this hasn't been passed to reposetup()
526 # Skip if this hasn't been passed to reposetup()
527 if util.safehasattr(
527 if util.safehasattr(srcrepo.svfs, 'lfslocalblobstore') and util.safehasattr(
528 srcrepo.svfs, b'lfslocalblobstore'
528 dstrepo.svfs, 'lfslocalblobstore'
529 ) and util.safehasattr(dstrepo.svfs, b'lfslocalblobstore'):
529 ):
530 srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs
530 srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs
531 dstlfsvfs = dstrepo.svfs.lfslocalblobstore.vfs
531 dstlfsvfs = dstrepo.svfs.lfslocalblobstore.vfs
532
532
General Comments 0
You need to be logged in to leave comments. Login now