mercurial/store.py
changeset 14090 e24b5e3c2f27
parent 13949 ba43aa1e173c
child 14092 222c8ec7a274
equal deleted inserted replaced
14089:d3f7e110c3c0 14090:e24b5e3c2f27
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from i18n import _
     8 from i18n import _
     9 import osutil, util
     9 import osutil, scmutil, util
    10 import os, stat
    10 import os, stat
    11 
    11 
    12 _sha = util.sha1
    12 _sha = util.sha1
    13 
    13 
    14 # This avoids a collision between a file named foo and a dir named
    14 # This avoids a collision between a file named foo and a dir named
   239     def __init__(self, path, opener):
   239     def __init__(self, path, opener):
   240         self.path = path
   240         self.path = path
   241         self.createmode = _calcmode(path)
   241         self.createmode = _calcmode(path)
   242         op = opener(self.path)
   242         op = opener(self.path)
   243         op.createmode = self.createmode
   243         op.createmode = self.createmode
   244         self.opener = lambda f, *args, **kw: op(encodedir(f), *args, **kw)
   244         self.opener = scmutil.filteropener(op, encodedir)
   245 
   245 
   246     def join(self, f):
   246     def join(self, f):
   247         return self.path + '/' + encodedir(f)
   247         return self.path + '/' + encodedir(f)
   248 
   248 
   249     def _walk(self, relpath, recurse):
   249     def _walk(self, relpath, recurse):
   288     def __init__(self, path, opener):
   288     def __init__(self, path, opener):
   289         self.path = path + '/store'
   289         self.path = path + '/store'
   290         self.createmode = _calcmode(self.path)
   290         self.createmode = _calcmode(self.path)
   291         op = opener(self.path)
   291         op = opener(self.path)
   292         op.createmode = self.createmode
   292         op.createmode = self.createmode
   293         self.opener = lambda f, *args, **kw: op(encodefilename(f), *args, **kw)
   293         self.opener = scmutil.filteropener(op, encodefilename)
   294 
   294 
   295     def datafiles(self):
   295     def datafiles(self):
   296         for a, b, size in self._walk('data', True):
   296         for a, b, size in self._walk('data', True):
   297             try:
   297             try:
   298                 a = decodefilename(a)
   298                 a = decodefilename(a)