mercurial/manifest.py
changeset 2843 0b50a580be36
parent 2470 fe1689273f84
child 2844 e196aa1df169
equal deleted inserted replaced
2601:00fc88b0b256 2843:0b50a580be36
     8 from revlog import *
     8 from revlog import *
     9 from i18n import gettext as _
     9 from i18n import gettext as _
    10 from demandload import *
    10 from demandload import *
    11 demandload(globals(), "array bisect struct")
    11 demandload(globals(), "array bisect struct")
    12 
    12 
       
    13 class manifestflags(dict):
       
    14     def __init__(self, mapping={}):
       
    15         dict.__init__(self, mapping)
       
    16     def execf(self, f):
       
    17         "test for executable in manifest flags"
       
    18         return self.get(f, False)
       
    19     def linkf(self, f):
       
    20         "test for symlink in manifest flags"
       
    21         return False
       
    22     def set(self, f, execf=False, linkf=False):
       
    23         self[f] = execf
       
    24     def copy(self):
       
    25         return manifestflags(dict.copy(self))
       
    26 
    13 class manifest(revlog):
    27 class manifest(revlog):
    14     def __init__(self, opener, defversion=REVLOGV0):
    28     def __init__(self, opener, defversion=REVLOGV0):
    15         self.mapcache = None
    29         self.mapcache = None
    16         self.listcache = None
    30         self.listcache = None
    17         revlog.__init__(self, opener, "00manifest.i", "00manifest.d",
    31         revlog.__init__(self, opener, "00manifest.i", "00manifest.d",
    21         if node == nullid: return {} # don't upset local cache
    35         if node == nullid: return {} # don't upset local cache
    22         if self.mapcache and self.mapcache[0] == node:
    36         if self.mapcache and self.mapcache[0] == node:
    23             return self.mapcache[1]
    37             return self.mapcache[1]
    24         text = self.revision(node)
    38         text = self.revision(node)
    25         map = {}
    39         map = {}
    26         flag = {}
    40         flag = manifestflags()
    27         self.listcache = array.array('c', text)
    41         self.listcache = array.array('c', text)
    28         lines = text.splitlines(1)
    42         lines = text.splitlines(1)
    29         for l in lines:
    43         for l in lines:
    30             (f, n) = l.split('\0')
    44             (f, n) = l.split('\0')
    31             map[f] = bin(n[:40])
    45             map[f] = bin(n[:40])