mercurial/dirstate.py
branchstable
changeset 16201 fb7c4c14223f
parent 16200 9d4a2942a732
child 16202 53e2cd303ecf
equal deleted inserted replaced
16200:9d4a2942a732 16201:fb7c4c14223f
    12 import struct, os, stat, errno
    12 import struct, os, stat, errno
    13 import cStringIO
    13 import cStringIO
    14 
    14 
    15 _format = ">cllll"
    15 _format = ">cllll"
    16 propertycache = util.propertycache
    16 propertycache = util.propertycache
       
    17 filecache = scmutil.filecache
       
    18 
       
    19 class repocache(filecache):
       
    20     """filecache for files in .hg/"""
       
    21     def join(self, obj, fname):
       
    22         return obj._opener.join(fname)
    17 
    23 
    18 def _finddirs(path):
    24 def _finddirs(path):
    19     pos = path.rfind('/')
    25     pos = path.rfind('/')
    20     while pos != -1:
    26     while pos != -1:
    21         yield path[:pos]
    27         yield path[:pos]
    76         for name in self._map:
    82         for name in self._map:
    77             f[util.normcase(name)] = name
    83             f[util.normcase(name)] = name
    78         f['.'] = '.' # prevents useless util.fspath() invocation
    84         f['.'] = '.' # prevents useless util.fspath() invocation
    79         return f
    85         return f
    80 
    86 
    81     @propertycache
    87     @repocache('branch')
    82     def _branch(self):
    88     def _branch(self):
    83         try:
    89         try:
    84             return self._opener.read("branch").strip() or "default"
    90             return self._opener.read("branch").strip() or "default"
    85         except IOError, inst:
    91         except IOError, inst:
    86             if inst.errno != errno.ENOENT:
    92             if inst.errno != errno.ENOENT: