##// END OF EJS Templates
revlog: replace the old `revlog_kind` approach with the new `target` one...
marmoute -
r47839:64cd1496 default
parent child Browse files
Show More
@@ -33,6 +33,7 b' from . import ('
33 33
34 34 from .interfaces import repository
35 35 from .revlogutils import sidedata as sidedatamod
36 from .revlogutils import constants as revlog_constants
36 37
37 38 _CHANGEGROUPV1_DELTA_HEADER = struct.Struct(b"20s20s20s20s")
38 39 _CHANGEGROUPV2_DELTA_HEADER = struct.Struct(b"20s20s20s20s20s")
@@ -385,15 +386,16 b' class cg1unpacker(object):'
385 386 _(b'manifests'), unit=_(b'chunks'), total=changesets
386 387 )
387 388 on_manifest_rev = None
388 if sidedata_helpers and b'manifest' in sidedata_helpers[1]:
389 if sidedata_helpers:
390 if revlog_constants.KIND_MANIFESTLOG in sidedata_helpers[1]:
389 391
390 def on_manifest_rev(manifest, rev):
391 range = touched_manifests.get(manifest)
392 if not range:
393 touched_manifests[manifest] = (rev, rev)
394 else:
395 assert rev == range[1] + 1
396 touched_manifests[manifest] = (range[0], rev)
392 def on_manifest_rev(manifest, rev):
393 range = touched_manifests.get(manifest)
394 if not range:
395 touched_manifests[manifest] = (rev, rev)
396 else:
397 assert rev == range[1] + 1
398 touched_manifests[manifest] = (range[0], rev)
397 399
398 400 self._unpackmanifests(
399 401 repo,
@@ -416,15 +418,16 b' class cg1unpacker(object):'
416 418 needfiles.setdefault(f, set()).add(n)
417 419
418 420 on_filelog_rev = None
419 if sidedata_helpers and b'filelog' in sidedata_helpers[1]:
421 if sidedata_helpers:
422 if revlog_constants.KIND_FILELOG in sidedata_helpers[1]:
420 423
421 def on_filelog_rev(filelog, rev):
422 range = touched_filelogs.get(filelog)
423 if not range:
424 touched_filelogs[filelog] = (rev, rev)
425 else:
426 assert rev == range[1] + 1
427 touched_filelogs[filelog] = (range[0], rev)
424 def on_filelog_rev(filelog, rev):
425 range = touched_filelogs.get(filelog)
426 if not range:
427 touched_filelogs[filelog] = (rev, rev)
428 else:
429 assert rev == range[1] + 1
430 touched_filelogs[filelog] = (range[0], rev)
428 431
429 432 # process the files
430 433 repo.ui.status(_(b"adding file changes\n"))
@@ -439,7 +442,7 b' class cg1unpacker(object):'
439 442 )
440 443
441 444 if sidedata_helpers:
442 if b'changelog' in sidedata_helpers[1]:
445 if revlog_constants.KIND_CHANGELOG in sidedata_helpers[1]:
443 446 cl.rewrite_sidedata(sidedata_helpers, clstart, clend - 1)
444 447 for mf, (startrev, endrev) in touched_manifests.items():
445 448 mf.rewrite_sidedata(sidedata_helpers, startrev, endrev)
@@ -431,7 +431,6 b' class changelog(revlog.revlog):'
431 431 self._filteredrevs = frozenset()
432 432 self._filteredrevs_hashcache = {}
433 433 self._copiesstorage = opener.options.get(b'copies-storage')
434 self.revlog_kind = b'changelog'
435 434
436 435 @property
437 436 def filteredrevs(self):
@@ -36,7 +36,6 b' class filelog(object):'
36 36 # Full name of the user visible file, relative to the repository root.
37 37 # Used by LFS.
38 38 self._revlog.filename = path
39 self._revlog.revlog_kind = b'filelog'
40 39 self.nullid = self._revlog.nullid
41 40
42 41 def __len__(self):
@@ -3368,8 +3368,8 b' class localrepository(object):'
3368 3368 self._wanted_sidedata.add(pycompat.bytestr(category))
3369 3369
3370 3370 def register_sidedata_computer(self, kind, category, keys, computer):
3371 if kind not in (b"changelog", b"manifest", b"filelog"):
3372 msg = _(b"unexpected revlog kind '%s'.")
3371 if kind not in revlogconst.ALL_KINDS:
3372 msg = _(b"unexpected revlog kind %r.")
3373 3373 raise error.ProgrammingError(msg % kind)
3374 3374 category = pycompat.bytestr(category)
3375 3375 if category in self._sidedata_computers.get(kind, []):
@@ -1625,7 +1625,6 b' class manifestrevlog(object):'
1625 1625 self.index = self._revlog.index
1626 1626 self.version = self._revlog.version
1627 1627 self._generaldelta = self._revlog._generaldelta
1628 self._revlog.revlog_kind = b'manifest'
1629 1628
1630 1629 def _setupmanifestcachehooks(self, repo):
1631 1630 """Persist the manifestfulltextcache on lock release"""
@@ -20,6 +20,7 b' from . import ('
20 20 )
21 21
22 22 from .revlogutils import (
23 constants as revlogconst,
23 24 flagutil as sidedataflag,
24 25 sidedata as sidedatamod,
25 26 )
@@ -826,7 +827,7 b' def set_sidedata_spec_for_repo(repo):'
826 827 if requirementsmod.COPIESSDC_REQUIREMENT in repo.requirements:
827 828 repo.register_wanted_sidedata(sidedatamod.SD_FILES)
828 829 repo.register_sidedata_computer(
829 b"changelog",
830 revlogconst.KIND_CHANGELOG,
830 831 sidedatamod.SD_FILES,
831 832 (sidedatamod.SD_FILES,),
832 833 copies_sidedata_computer,
@@ -559,6 +559,10 b' class revlog(object):'
559 559 self._decompressors = {}
560 560
561 561 @util.propertycache
562 def revlog_kind(self):
563 return self.target[0]
564
565 @util.propertycache
562 566 def _compressor(self):
563 567 engine = util.compengines[self._compengine]
564 568 return engine.revlogcompressor(self._compengineopts)
@@ -14,6 +14,7 b' import hashlib'
14 14 import struct
15 15
16 16 from mercurial.revlogutils import sidedata as sidedatamod
17 from mercurial.revlogutils import constants
17 18
18 19
19 20 def compute_sidedata_1(repo, revlog, rev, sidedata, text=None):
@@ -35,7 +36,7 b' def compute_sidedata_2(repo, revlog, rev'
35 36
36 37 def reposetup(ui, repo):
37 38 # Sidedata keys happen to be the same as the categories, easier for testing.
38 for kind in (b'changelog', b'manifest', b'filelog'):
39 for kind in constants.ALL_KINDS:
39 40 repo.register_sidedata_computer(
40 41 kind,
41 42 sidedatamod.SD_TEST1,
@@ -20,6 +20,7 b' from mercurial import ('
20 20 )
21 21
22 22 from mercurial.revlogutils import sidedata as sidedatamod
23 from mercurial.revlogutils import constants
23 24
24 25
25 26 def compute_sidedata_1(repo, revlog, rev, sidedata, text=None):
@@ -65,7 +66,7 b' def extsetup(ui):'
65 66
66 67 def reposetup(ui, repo):
67 68 # Sidedata keys happen to be the same as the categories, easier for testing.
68 for kind in (b'changelog', b'manifest', b'filelog'):
69 for kind in constants.ALL_KINDS:
69 70 repo.register_sidedata_computer(
70 71 kind,
71 72 sidedatamod.SD_TEST1,
@@ -21,6 +21,7 b' from mercurial import ('
21 21
22 22
23 23 from mercurial.revlogutils import sidedata as sidedatamod
24 from mercurial.revlogutils import constants
24 25
25 26
26 27 def compute_sidedata_1(repo, revlog, rev, sidedata, text=None):
@@ -42,7 +43,7 b' def compute_sidedata_2(repo, revlog, rev'
42 43
43 44 def reposetup(ui, repo):
44 45 # Sidedata keys happen to be the same as the categories, easier for testing.
45 for kind in (b'changelog', b'manifest', b'filelog'):
46 for kind in constants.ALL_KINDS:
46 47 repo.register_sidedata_computer(
47 48 kind,
48 49 sidedatamod.SD_TEST1,
General Comments 0
You need to be logged in to leave comments. Login now