mercurial/manifest.py
changeset 2853 e3fb4223e750
parent 2851 b4f05ecf4ee8
child 2856 18cf5349a361
equal deleted inserted replaced
2852:046a8b03ea59 2853:e3fb4223e750
    50         for l in lines:
    50         for l in lines:
    51             (f, n) = l.split('\0')
    51             (f, n) = l.split('\0')
    52             mapping.rawset(f, n)
    52             mapping.rawset(f, n)
    53         self.mapcache = (node, mapping)
    53         self.mapcache = (node, mapping)
    54         return mapping
    54         return mapping
    55 
       
    56     def readflags(self, node):
       
    57         return self.read(node)
       
    58 
    55 
    59     def diff(self, a, b):
    56     def diff(self, a, b):
    60         return mdiff.textdiff(str(a), str(b))
    57         return mdiff.textdiff(str(a), str(b))
    61 
    58 
    62     def _search(self, m, s, lo=0, hi=None):
    59     def _search(self, m, s, lo=0, hi=None):
   110             return None, None
   107             return None, None
   111         l = text[start:end]
   108         l = text[start:end]
   112         f, n = l.split('\0')
   109         f, n = l.split('\0')
   113         return bin(n[:40]), n[40:-1] == 'x'
   110         return bin(n[:40]), n[40:-1] == 'x'
   114 
   111 
   115     def add(self, map, flags, transaction, link, p1=None, p2=None,
   112     def add(self, map, transaction, link, p1=None, p2=None,
   116             changed=None):
   113             changed=None):
   117         # apply the changes collected during the bisect loop to our addlist
   114         # apply the changes collected during the bisect loop to our addlist
   118         # return a delta suitable for addrevision
   115         # return a delta suitable for addrevision
   119         def addlistdelta(addlist, x):
   116         def addlistdelta(addlist, x):
   120             # start from the bottom up
   117             # start from the bottom up
   138             files = map.keys()
   135             files = map.keys()
   139             files.sort()
   136             files.sort()
   140 
   137 
   141             # if this is changed to support newlines in filenames,
   138             # if this is changed to support newlines in filenames,
   142             # be sure to check the templates/ dir again (especially *-raw.tmpl)
   139             # be sure to check the templates/ dir again (especially *-raw.tmpl)
   143             text = ["%s\000%s%s\n" % (f, hex(map[f]), flags.flags(f)) for f in files]
   140             text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f)) for f in files]
   144             self.listcache = array.array('c', "".join(text))
   141             self.listcache = array.array('c', "".join(text))
   145             cachedelta = None
   142             cachedelta = None
   146         else:
   143         else:
   147             addlist = self.listcache
   144             addlist = self.listcache
   148 
   145 
   164             for w in work:
   161             for w in work:
   165                 f = w[0]
   162                 f = w[0]
   166                 # bs will either be the index of the item or the insert point
   163                 # bs will either be the index of the item or the insert point
   167                 start, end = self._search(addbuf, f, start)
   164                 start, end = self._search(addbuf, f, start)
   168                 if w[1] == 0:
   165                 if w[1] == 0:
   169                     l = "%s\000%s%s\n" % (f, hex(map[f]), flags.flags(f))
   166                     l = "%s\000%s%s\n" % (f, hex(map[f]), map.flags(f))
   170                 else:
   167                 else:
   171                     l = ""
   168                     l = ""
   172                 if start == end and w[1] == 1:
   169                 if start == end and w[1] == 1:
   173                     # item we want to delete was not found, error out
   170                     # item we want to delete was not found, error out
   174                     raise AssertionError(
   171                     raise AssertionError(