equal
deleted
inserted
replaced
353 v = struct.unpack(versionformat, i)[0] |
353 v = struct.unpack(versionformat, i)[0] |
354 flags = v & ~0xFFFF |
354 flags = v & ~0xFFFF |
355 fmt = v & 0xFFFF |
355 fmt = v & 0xFFFF |
356 if fmt == REVLOGV0: |
356 if fmt == REVLOGV0: |
357 if flags: |
357 if flags: |
358 raise RevlogError(_("index %s invalid flags %x for format v0") % |
358 raise RevlogError(_("index %s invalid flags %x for format v0") |
359 (self.indexfile, flags)) |
359 % (self.indexfile, flags)) |
360 elif fmt == REVLOGNG: |
360 elif fmt == REVLOGNG: |
361 if flags & ~REVLOGNGINLINEDATA: |
361 if flags & ~REVLOGNGINLINEDATA: |
362 raise RevlogError(_("index %s invalid flags %x for revlogng") % |
362 raise RevlogError(_("index %s invalid flags %x for revlogng") |
363 (self.indexfile, flags)) |
363 % (self.indexfile, flags)) |
364 else: |
364 else: |
365 raise RevlogError(_("index %s invalid format %d") % |
365 raise RevlogError(_("index %s invalid format %d") |
366 (self.indexfile, fmt)) |
366 % (self.indexfile, fmt)) |
367 self.version = v |
367 self.version = v |
368 if v == REVLOGV0: |
368 if v == REVLOGV0: |
369 self.indexformat = indexformatv0 |
369 self.indexformat = indexformatv0 |
370 shaoffset = v0shaoffset |
370 shaoffset = v0shaoffset |
371 else: |
371 else: |
913 text = self.patches(text, bins) |
913 text = self.patches(text, bins) |
914 |
914 |
915 p1, p2 = self.parents(node) |
915 p1, p2 = self.parents(node) |
916 if node != hash(text, p1, p2): |
916 if node != hash(text, p1, p2): |
917 raise RevlogError(_("integrity check failed on %s:%d") |
917 raise RevlogError(_("integrity check failed on %s:%d") |
918 % (self.datafile, rev)) |
918 % (self.datafile, rev)) |
919 |
919 |
920 self.cache = (node, rev, text) |
920 self.cache = (node, rev, text) |
921 return text |
921 return text |
922 |
922 |
923 def checkinlinesize(self, tr, fp=None): |
923 def checkinlinesize(self, tr, fp=None): |
929 size = fp.tell() |
929 size = fp.tell() |
930 if size < 131072: |
930 if size < 131072: |
931 return |
931 return |
932 trinfo = tr.find(self.indexfile) |
932 trinfo = tr.find(self.indexfile) |
933 if trinfo == None: |
933 if trinfo == None: |
934 raise RevlogError(_("%s not found in the transaction") % |
934 raise RevlogError(_("%s not found in the transaction") |
935 self.indexfile) |
935 % self.indexfile) |
936 |
936 |
937 trindex = trinfo[2] |
937 trindex = trinfo[2] |
938 dataoff = self.start(trindex) |
938 dataoff = self.start(trindex) |
939 |
939 |
940 tr.add(self.datafile, dataoff) |
940 tr.add(self.datafile, dataoff) |