hgext/largefiles/lfutil.py
branchstable
changeset 16155 1b2b42e866be
parent 16153 05197f9fd1f3
child 16166 5b0a4383cd5e
equal deleted inserted replaced
16154:9b072a5f8f92 16155:1b2b42e866be
    11 import os
    11 import os
    12 import errno
    12 import errno
    13 import platform
    13 import platform
    14 import shutil
    14 import shutil
    15 import stat
    15 import stat
    16 import tempfile
       
    17 
    16 
    18 from mercurial import dirstate, httpconnection, match as match_, util, scmutil
    17 from mercurial import dirstate, httpconnection, match as match_, util, scmutil
    19 from mercurial.i18n import _
    18 from mercurial.i18n import _
    20 
    19 
    21 shortname = '.hglf'
    20 shortname = '.hglf'
   437 
   436 
   438 def islfilesrepo(repo):
   437 def islfilesrepo(repo):
   439     return ('largefiles' in repo.requirements and
   438     return ('largefiles' in repo.requirements and
   440             util.any(shortname + '/' in f[0] for f in repo.store.datafiles()))
   439             util.any(shortname + '/' in f[0] for f in repo.store.datafiles()))
   441 
   440 
   442 def mkstemp(repo, prefix):
       
   443     '''Returns a file descriptor and a filename corresponding to a temporary
       
   444     file in the repo's largefiles store.'''
       
   445     path = repo.join(longname)
       
   446     util.makedirs(path)
       
   447     return tempfile.mkstemp(prefix=prefix, dir=path)
       
   448 
       
   449 class storeprotonotcapable(Exception):
   441 class storeprotonotcapable(Exception):
   450     def __init__(self, storetypes):
   442     def __init__(self, storetypes):
   451         self.storetypes = storetypes
   443         self.storetypes = storetypes
   452 
   444 
   453 def getcurrentheads(repo):
   445 def getcurrentheads(repo):