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