##// END OF EJS Templates
revlog: add punched revision flag...
Vishakh H -
r11745:138c055e default
parent child Browse files
Show More
@@ -30,6 +30,8 b' REVLOGNGINLINEDATA = (1 << 16)'
30 REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
30 REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
31 REVLOG_DEFAULT_FORMAT = REVLOGNG
31 REVLOG_DEFAULT_FORMAT = REVLOGNG
32 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
32 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
33 REVIDX_PUNCHED_FLAG = 2
34 REVIDX_KNOWN_FLAGS = REVIDX_PUNCHED_FLAG
33
35
34 # amount of data read unconditionally, should be >= 4
36 # amount of data read unconditionally, should be >= 4
35 # when not inline: threshold for using lazy index
37 # when not inline: threshold for using lazy index
@@ -1022,9 +1024,9 b' class revlog(object):'
1022 base = self.base(rev)
1024 base = self.base(rev)
1023
1025
1024 # check rev flags
1026 # check rev flags
1025 if self.flags(rev):
1027 if self.flags(rev) & ~REVIDX_KNOWN_FLAGS:
1026 raise RevlogError(_('incompatible revision flag %x') %
1028 raise RevlogError(_('incompatible revision flag %x') %
1027 (self.flags(rev)))
1029 (self.flags(rev) & ~REVIDX_KNOWN_FLAGS))
1028
1030
1029 # do we have useful data cached?
1031 # do we have useful data cached?
1030 if self._cache and self._cache[1] >= base and self._cache[1] < rev:
1032 if self._cache and self._cache[1] >= base and self._cache[1] < rev:
@@ -1039,7 +1041,8 b' class revlog(object):'
1039 bins = [self._chunk(r) for r in xrange(base + 1, rev + 1)]
1041 bins = [self._chunk(r) for r in xrange(base + 1, rev + 1)]
1040 text = mdiff.patches(text, bins)
1042 text = mdiff.patches(text, bins)
1041 p1, p2 = self.parents(node)
1043 p1, p2 = self.parents(node)
1042 if node != hash(text, p1, p2):
1044 if (node != hash(text, p1, p2) and
1045 not (self.flags(rev) & REVIDX_PUNCHED_FLAG)):
1043 raise RevlogError(_("integrity check failed on %s:%d")
1046 raise RevlogError(_("integrity check failed on %s:%d")
1044 % (self.indexfile, rev))
1047 % (self.indexfile, rev))
1045
1048
@@ -1125,7 +1128,9 b' class revlog(object):'
1125
1128
1126 # full versions are inserted when the needed deltas
1129 # full versions are inserted when the needed deltas
1127 # become comparable to the uncompressed text
1130 # become comparable to the uncompressed text
1128 if not curr or dist > len(text) * 2:
1131 # or the base revision is punched
1132 if (not curr or dist > len(text) * 2 or
1133 (self.flags(base) & REVIDX_PUNCHED_FLAG)):
1129 data = compress(text)
1134 data = compress(text)
1130 l = len(data[1]) + len(data[0])
1135 l = len(data[1]) + len(data[0])
1131 base = curr
1136 base = curr
General Comments 0
You need to be logged in to leave comments. Login now