hgext/lfs/wrapper.py
changeset 39858 bcf72d7b1524
parent 39856 1f7b3b980af8
child 39860 62a532045e71
equal deleted inserted replaced
39857:2c2fadbc9851 39858:bcf72d7b1524
   225     # also copy lfs blobstores. note: this can run before reposetup, so lfs
   225     # also copy lfs blobstores. note: this can run before reposetup, so lfs
   226     # blobstore attributes are not always ready at this time.
   226     # blobstore attributes are not always ready at this time.
   227     for name in ['lfslocalblobstore', 'lfsremoteblobstore']:
   227     for name in ['lfslocalblobstore', 'lfsremoteblobstore']:
   228         if util.safehasattr(othervfs, name):
   228         if util.safehasattr(othervfs, name):
   229             setattr(self, name, getattr(othervfs, name))
   229             setattr(self, name, getattr(othervfs, name))
   230 
       
   231 def hgclone(orig, ui, opts, *args, **kwargs):
       
   232     result = orig(ui, opts, *args, **kwargs)
       
   233 
       
   234     if result is not None:
       
   235         sourcerepo, destrepo = result
       
   236         repo = destrepo.local()
       
   237 
       
   238         # When cloning to a remote repo (like through SSH), no repo is available
       
   239         # from the peer.  Therefore the hgrc can't be updated.
       
   240         if not repo:
       
   241             return result
       
   242 
       
   243         # If lfs is required for this repo, permanently enable it locally
       
   244         if 'lfs' in repo.requirements:
       
   245             repo.vfs.append('hgrc',
       
   246                             util.tonativeeol('\n[extensions]\nlfs=\n'))
       
   247 
       
   248     return result
       
   249 
       
   250 def hgpostshare(orig, sourcerepo, destrepo, defaultpath=None):
       
   251     orig(sourcerepo, destrepo, defaultpath=defaultpath)
       
   252 
       
   253     # If lfs is required for this repo, permanently enable it locally
       
   254     if 'lfs' in destrepo.requirements:
       
   255         destrepo.vfs.append('hgrc', util.tonativeeol('\n[extensions]\nlfs=\n'))
       
   256 
   230 
   257 def _prefetchfiles(repo, revs, match):
   231 def _prefetchfiles(repo, revs, match):
   258     """Ensure that required LFS blobs are present, fetching them as a group if
   232     """Ensure that required LFS blobs are present, fetching them as a group if
   259     needed."""
   233     needed."""
   260     if not util.safehasattr(repo.svfs, 'lfslocalblobstore'):
   234     if not util.safehasattr(repo.svfs, 'lfslocalblobstore'):