##// END OF EJS Templates
revlog: split the `version` attribute into its two components...
marmoute -
r47910:f58a13c5 default
parent child Browse files
Show More
@@ -413,10 +413,10 b' class changelog(revlog.revlog):'
413 concurrencychecker=concurrencychecker,
413 concurrencychecker=concurrencychecker,
414 )
414 )
415
415
416 if self._initempty and (self.version & 0xFFFF == revlog.REVLOGV1):
416 if self._initempty and (self._format_version == revlog.REVLOGV1):
417 # changelogs don't benefit from generaldelta.
417 # changelogs don't benefit from generaldelta.
418
418
419 self.version &= ~revlog.FLAG_GENERALDELTA
419 self._format_flags &= ~revlog.FLAG_GENERALDELTA
420 self._generaldelta = False
420 self._generaldelta = False
421
421
422 # Delta chains for changelogs tend to be very small because entries
422 # Delta chains for changelogs tend to be very small because entries
@@ -2972,8 +2972,8 b' def debugrevlog(ui, repo, file_=None, **'
2972 )
2972 )
2973 return 0
2973 return 0
2974
2974
2975 v = r.version
2975 format = r._format_version
2976 format = v & 0xFFFF
2976 v = r._format_flags
2977 flags = []
2977 flags = []
2978 gdelta = False
2978 gdelta = False
2979 if v & revlog.FLAG_INLINE_DATA:
2979 if v & revlog.FLAG_INLINE_DATA:
@@ -1181,13 +1181,6 b' class imanifeststorage(interfaceutil.Int'
1181 """
1181 """
1182 )
1182 )
1183
1183
1184 version = interfaceutil.Attribute(
1185 """Revlog version number.
1186
1187 TODO this is revlog specific and should not be exposed.
1188 """
1189 )
1190
1191 _generaldelta = interfaceutil.Attribute(
1184 _generaldelta = interfaceutil.Attribute(
1192 """Whether generaldelta storage is being used.
1185 """Whether generaldelta storage is being used.
1193
1186
@@ -1623,7 +1623,6 b' class manifestrevlog(object):'
1623 )
1623 )
1624
1624
1625 self.index = self._revlog.index
1625 self.index = self._revlog.index
1626 self.version = self._revlog.version
1627 self._generaldelta = self._revlog._generaldelta
1626 self._generaldelta = self._revlog._generaldelta
1628
1627
1629 def _setupmanifestcachehooks(self, repo):
1628 def _setupmanifestcachehooks(self, repo):
@@ -451,10 +451,8 b' class revlog(object):'
451
451
452 versionflags = newversionflags
452 versionflags = newversionflags
453
453
454 self.version = versionflags
454 flags = self._format_flags = versionflags & ~0xFFFF
455
455 fmt = self._format_version = versionflags & 0xFFFF
456 flags = versionflags & ~0xFFFF
457 fmt = versionflags & 0xFFFF
458
456
459 if fmt == REVLOGV0:
457 if fmt == REVLOGV0:
460 if flags:
458 if flags:
@@ -519,7 +517,7 b' class revlog(object):'
519 use_rust_index = self.opener.options.get(b'rust.index')
517 use_rust_index = self.opener.options.get(b'rust.index')
520
518
521 self._parse_index = parse_index_v1
519 self._parse_index = parse_index_v1
522 if self.version == REVLOGV0:
520 if self._format_version == REVLOGV0:
523 self._parse_index = revlogv0.parse_index_v0
521 self._parse_index = revlogv0.parse_index_v0
524 elif fmt == REVLOGV2:
522 elif fmt == REVLOGV2:
525 self._parse_index = parse_index_v2
523 self._parse_index = parse_index_v2
@@ -1945,12 +1943,13 b' class revlog(object):'
1945 trindex = r
1943 trindex = r
1946
1944
1947 with self._indexfp(b'w') as fp:
1945 with self._indexfp(b'w') as fp:
1948 self.version &= ~FLAG_INLINE_DATA
1946 self._format_flags &= ~FLAG_INLINE_DATA
1949 self._inline = False
1947 self._inline = False
1950 for i in self:
1948 for i in self:
1951 e = self.index.entry_binary(i)
1949 e = self.index.entry_binary(i)
1952 if i == 0:
1950 if i == 0:
1953 header = self.index.pack_header(self.version)
1951 header = self._format_flags | self._format_version
1952 header = self.index.pack_header(header)
1954 e = header + e
1953 e = header + e
1955 fp.write(e)
1954 fp.write(e)
1956
1955
@@ -2269,13 +2268,14 b' class revlog(object):'
2269 len(serialized_sidedata),
2268 len(serialized_sidedata),
2270 )
2269 )
2271
2270
2272 if self.version & 0xFFFF != REVLOGV2:
2271 if self._format_version != REVLOGV2:
2273 e = e[:8]
2272 e = e[:8]
2274
2273
2275 self.index.append(e)
2274 self.index.append(e)
2276 entry = self.index.entry_binary(curr)
2275 entry = self.index.entry_binary(curr)
2277 if curr == 0:
2276 if curr == 0:
2278 header = self.index.pack_header(self.version)
2277 header = self._format_flags | self._format_version
2278 header = self.index.pack_header(header)
2279 entry = header + entry
2279 entry = header + entry
2280 self._writeentry(
2280 self._writeentry(
2281 transaction,
2281 transaction,
@@ -2307,7 +2307,7 b' class revlog(object):'
2307 to `n - 1`'s sidedata being written after `n`'s data.
2307 to `n - 1`'s sidedata being written after `n`'s data.
2308
2308
2309 TODO cache this in a docket file before getting out of experimental."""
2309 TODO cache this in a docket file before getting out of experimental."""
2310 if self.version & 0xFFFF != REVLOGV2:
2310 if self._format_version != REVLOGV2:
2311 return self.end(prev)
2311 return self.end(prev)
2312
2312
2313 offset = 0
2313 offset = 0
@@ -2847,9 +2847,10 b' class revlog(object):'
2847 addrevisioncb(self, rev, node)
2847 addrevisioncb(self, rev, node)
2848
2848
2849 def censorrevision(self, tr, censornode, tombstone=b''):
2849 def censorrevision(self, tr, censornode, tombstone=b''):
2850 if (self.version & 0xFFFF) == REVLOGV0:
2850 if self._format_version == REVLOGV0:
2851 raise error.RevlogError(
2851 raise error.RevlogError(
2852 _(b'cannot censor with version %d revlogs') % self.version
2852 _(b'cannot censor with version %d revlogs')
2853 % self._format_version
2853 )
2854 )
2854
2855
2855 censorrev = self.rev(censornode)
2856 censorrev = self.rev(censornode)
@@ -2875,7 +2876,8 b' class revlog(object):'
2875 datafile=newdatafile,
2876 datafile=newdatafile,
2876 censorable=True,
2877 censorable=True,
2877 )
2878 )
2878 newrl.version = self.version
2879 newrl._format_version = self._format_version
2880 newrl._format_flags = self._format_flags
2879 newrl._generaldelta = self._generaldelta
2881 newrl._generaldelta = self._generaldelta
2880 newrl._parse_index = self._parse_index
2882 newrl._parse_index = self._parse_index
2881
2883
@@ -2947,7 +2949,7 b' class revlog(object):'
2947 if di:
2949 if di:
2948 yield revlogproblem(error=_(b'index contains %d extra bytes') % di)
2950 yield revlogproblem(error=_(b'index contains %d extra bytes') % di)
2949
2951
2950 version = self.version & 0xFFFF
2952 version = self._format_version
2951
2953
2952 # The verifier tells us what version revlog we should be.
2954 # The verifier tells us what version revlog we should be.
2953 if version != state[b'expectedversion']:
2955 if version != state[b'expectedversion']:
@@ -3137,6 +3139,7 b' class revlog(object):'
3137 self.index.replace_sidedata_info(rev, e[8], e[9], e[0])
3139 self.index.replace_sidedata_info(rev, e[8], e[9], e[0])
3138 packed = self.index.entry_binary(rev)
3140 packed = self.index.entry_binary(rev)
3139 if rev == 0:
3141 if rev == 0:
3140 header = self.index.pack_header(self.version)
3142 header = self._format_flags | self._format_version
3143 header = self.index.pack_header(header)
3141 packed = header + packed
3144 packed = header + packed
3142 fp.write(packed)
3145 fp.write(packed)
@@ -51,7 +51,7 b' class verifier(object):'
51 self.warnings = 0
51 self.warnings = 0
52 self.havecl = len(repo.changelog) > 0
52 self.havecl = len(repo.changelog) > 0
53 self.havemf = len(repo.manifestlog.getstorage(b'')) > 0
53 self.havemf = len(repo.manifestlog.getstorage(b'')) > 0
54 self.revlogv1 = repo.changelog.version != revlog.REVLOGV0
54 self.revlogv1 = repo.changelog._format_version != revlog.REVLOGV0
55 self.lrugetctx = util.lrucachefunc(repo.unfiltered().__getitem__)
55 self.lrugetctx = util.lrucachefunc(repo.unfiltered().__getitem__)
56 self.refersmf = False
56 self.refersmf = False
57 self.fncachewarned = False
57 self.fncachewarned = False
@@ -102,7 +102,7 b' class verifier(object):'
102 if d[1]:
102 if d[1]:
103 self._err(None, _(b"index contains %d extra bytes") % d[1], name)
103 self._err(None, _(b"index contains %d extra bytes") % d[1], name)
104
104
105 if obj.version != revlog.REVLOGV0:
105 if obj._format_version != revlog.REVLOGV0:
106 if not self.revlogv1:
106 if not self.revlogv1:
107 self._warn(_(b"warning: `%s' uses revlog format 1") % name)
107 self._warn(_(b"warning: `%s' uses revlog format 1") % name)
108 elif self.revlogv1:
108 elif self.revlogv1:
@@ -483,7 +483,7 b' class verifier(object):'
483
483
484 state = {
484 state = {
485 # TODO this assumes revlog storage for changelog.
485 # TODO this assumes revlog storage for changelog.
486 b'expectedversion': self.repo.changelog.version & 0xFFFF,
486 b'expectedversion': self.repo.changelog._format_version,
487 b'skipflags': self.skipflags,
487 b'skipflags': self.skipflags,
488 # experimental config: censor.policy
488 # experimental config: censor.policy
489 b'erroroncensored': ui.config(b'censor', b'policy') == b'abort',
489 b'erroroncensored': ui.config(b'censor', b'policy') == b'abort',
General Comments 0
You need to be logged in to leave comments. Login now