##// END OF EJS Templates
dirstate-v2: Add `hg debugupgraderepo` command support...
Simon Sapin -
r48111:a43d256c default
parent child Browse files
Show More
@@ -1775,6 +1775,12 b' if rustmod is not None:'
1775 # for consistent view between _pl() and _read() invocations
1775 # for consistent view between _pl() and _read() invocations
1776 self._pendingmode = None
1776 self._pendingmode = None
1777
1777
1778 self._use_dirstate_tree = self._ui.configbool(
1779 b"experimental",
1780 b"dirstate-tree.in-memory",
1781 False,
1782 )
1783
1778 def addfile(self, *args, **kwargs):
1784 def addfile(self, *args, **kwargs):
1779 return self._rustmap.addfile(*args, **kwargs)
1785 return self._rustmap.addfile(*args, **kwargs)
1780
1786
@@ -1903,13 +1909,8 b' if rustmod is not None:'
1903 raise
1909 raise
1904 st = b''
1910 st = b''
1905
1911
1906 use_dirstate_tree = self._ui.configbool(
1907 b"experimental",
1908 b"dirstate-tree.in-memory",
1909 False,
1910 )
1911 self._rustmap, parents = rustmod.DirstateMap.new(
1912 self._rustmap, parents = rustmod.DirstateMap.new(
1912 use_dirstate_tree, self._use_dirstate_v2, st
1913 self._use_dirstate_tree, self._use_dirstate_v2, st
1913 )
1914 )
1914
1915
1915 if parents and not self._dirtyparents:
1916 if parents and not self._dirtyparents:
@@ -80,7 +80,7 b' class improvement(object):'
80 # operation in which this improvement was removed
80 # operation in which this improvement was removed
81 postdowngrademessage = None
81 postdowngrademessage = None
82
82
83 # By default for now, we assume every improvement touches all the things
83 # By default we assume that every improvement touches requirements and all revlogs
84
84
85 # Whether this improvement touches filelogs
85 # Whether this improvement touches filelogs
86 touches_filelogs = True
86 touches_filelogs = True
@@ -94,6 +94,9 b' class improvement(object):'
94 # Whether this improvement changes repository requirements
94 # Whether this improvement changes repository requirements
95 touches_requirements = True
95 touches_requirements = True
96
96
97 # Whether this improvement touches the dirstate
98 touches_dirstate = False
99
97
100
98 allformatvariant = [] # type: List[Type['formatvariant']]
101 allformatvariant = [] # type: List[Type['formatvariant']]
99
102
@@ -167,6 +170,27 b' class fncache(requirementformatvariant):'
167
170
168
171
169 @registerformatvariant
172 @registerformatvariant
173 class dirstatev2(requirementformatvariant):
174 name = b'dirstate-v2'
175 _requirement = requirements.DIRSTATE_V2_REQUIREMENT
176
177 default = False
178
179 description = _(
180 b'version 1 of the dirstate file format requires '
181 b'reading and parsing it all at once.'
182 )
183
184 upgrademessage = _(b'"hg status" will be faster')
185
186 touches_filelogs = False
187 touches_manifests = False
188 touches_changelog = False
189 touches_requirements = True
190 touches_dirstate = True
191
192
193 @registerformatvariant
170 class dotencode(requirementformatvariant):
194 class dotencode(requirementformatvariant):
171 name = b'dotencode'
195 name = b'dotencode'
172
196
@@ -644,7 +668,6 b' class UpgradeOperation(object):'
644 self.current_requirements = current_requirements
668 self.current_requirements = current_requirements
645 # list of upgrade actions the operation will perform
669 # list of upgrade actions the operation will perform
646 self.upgrade_actions = upgrade_actions
670 self.upgrade_actions = upgrade_actions
647 self._upgrade_actions_names = set([a.name for a in upgrade_actions])
648 self.removed_actions = removed_actions
671 self.removed_actions = removed_actions
649 self.revlogs_to_process = revlogs_to_process
672 self.revlogs_to_process = revlogs_to_process
650 # requirements which will be added by the operation
673 # requirements which will be added by the operation
@@ -667,41 +690,42 b' class UpgradeOperation(object):'
667 ]
690 ]
668
691
669 # delta reuse mode of this upgrade operation
692 # delta reuse mode of this upgrade operation
693 upgrade_actions_names = self.upgrade_actions_names
670 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
694 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
671 if b're-delta-all' in self._upgrade_actions_names:
695 if b're-delta-all' in upgrade_actions_names:
672 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
696 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
673 elif b're-delta-parent' in self._upgrade_actions_names:
697 elif b're-delta-parent' in upgrade_actions_names:
674 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
698 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
675 elif b're-delta-multibase' in self._upgrade_actions_names:
699 elif b're-delta-multibase' in upgrade_actions_names:
676 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
700 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
677 elif b're-delta-fulladd' in self._upgrade_actions_names:
701 elif b're-delta-fulladd' in upgrade_actions_names:
678 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
702 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
679
703
680 # should this operation force re-delta of both parents
704 # should this operation force re-delta of both parents
681 self.force_re_delta_both_parents = (
705 self.force_re_delta_both_parents = (
682 b're-delta-multibase' in self._upgrade_actions_names
706 b're-delta-multibase' in upgrade_actions_names
683 )
707 )
684
708
685 # should this operation create a backup of the store
709 # should this operation create a backup of the store
686 self.backup_store = backup_store
710 self.backup_store = backup_store
687
711
688 # whether the operation touches different revlogs at all or not
712 @property
689 self.touches_filelogs = self._touches_filelogs()
713 def upgrade_actions_names(self):
690 self.touches_manifests = self._touches_manifests()
714 return set([a.name for a in self.upgrade_actions])
691 self.touches_changelog = self._touches_changelog()
715
692 # whether the operation touches requirements file or not
716 @property
693 self.touches_requirements = self._touches_requirements()
717 def requirements_only(self):
694 self.touches_store = (
695 self.touches_filelogs
696 or self.touches_manifests
697 or self.touches_changelog
698 )
699 # does the operation only touches repository requirement
718 # does the operation only touches repository requirement
700 self.requirements_only = (
719 return (
701 self.touches_requirements and not self.touches_store
720 self.touches_requirements
721 and not self.touches_filelogs
722 and not self.touches_manifests
723 and not self.touches_changelog
724 and not self.touches_dirstate
702 )
725 )
703
726
704 def _touches_filelogs(self):
727 @property
728 def touches_filelogs(self):
705 for a in self.upgrade_actions:
729 for a in self.upgrade_actions:
706 # in optimisations, we re-process the revlogs again
730 # in optimisations, we re-process the revlogs again
707 if a.type == OPTIMISATION:
731 if a.type == OPTIMISATION:
@@ -713,7 +737,8 b' class UpgradeOperation(object):'
713 return True
737 return True
714 return False
738 return False
715
739
716 def _touches_manifests(self):
740 @property
741 def touches_manifests(self):
717 for a in self.upgrade_actions:
742 for a in self.upgrade_actions:
718 # in optimisations, we re-process the revlogs again
743 # in optimisations, we re-process the revlogs again
719 if a.type == OPTIMISATION:
744 if a.type == OPTIMISATION:
@@ -725,7 +750,8 b' class UpgradeOperation(object):'
725 return True
750 return True
726 return False
751 return False
727
752
728 def _touches_changelog(self):
753 @property
754 def touches_changelog(self):
729 for a in self.upgrade_actions:
755 for a in self.upgrade_actions:
730 # in optimisations, we re-process the revlogs again
756 # in optimisations, we re-process the revlogs again
731 if a.type == OPTIMISATION:
757 if a.type == OPTIMISATION:
@@ -737,7 +763,8 b' class UpgradeOperation(object):'
737 return True
763 return True
738 return False
764 return False
739
765
740 def _touches_requirements(self):
766 @property
767 def touches_requirements(self):
741 for a in self.upgrade_actions:
768 for a in self.upgrade_actions:
742 # optimisations are used to re-process revlogs and does not result
769 # optimisations are used to re-process revlogs and does not result
743 # in a requirement being added or removed
770 # in a requirement being added or removed
@@ -749,6 +776,18 b' class UpgradeOperation(object):'
749 if a.touches_requirements:
776 if a.touches_requirements:
750 return True
777 return True
751
778
779 @property
780 def touches_dirstate(self):
781 for a in self.upgrade_actions:
782 # revlog optimisations do not affect the dirstate
783 if a.type == OPTIMISATION:
784 pass
785 elif a.touches_dirstate:
786 return True
787 for a in self.removed_actions:
788 if a.touches_dirstate:
789 return True
790
752 return False
791 return False
753
792
754 def _write_labeled(self, l, label):
793 def _write_labeled(self, l, label):
@@ -908,6 +947,7 b' def supportremovedrequirements(repo):'
908 requirements.REVLOGV2_REQUIREMENT,
947 requirements.REVLOGV2_REQUIREMENT,
909 requirements.CHANGELOGV2_REQUIREMENT,
948 requirements.CHANGELOGV2_REQUIREMENT,
910 requirements.REVLOGV1_REQUIREMENT,
949 requirements.REVLOGV1_REQUIREMENT,
950 requirements.DIRSTATE_V2_REQUIREMENT,
911 }
951 }
912 for name in compression.compengines:
952 for name in compression.compengines:
913 engine = compression.compengines[name]
953 engine = compression.compengines[name]
@@ -970,6 +1010,7 b' def allowednewrequirements(repo):'
970 requirements.REVLOGV1_REQUIREMENT,
1010 requirements.REVLOGV1_REQUIREMENT,
971 requirements.REVLOGV2_REQUIREMENT,
1011 requirements.REVLOGV2_REQUIREMENT,
972 requirements.CHANGELOGV2_REQUIREMENT,
1012 requirements.CHANGELOGV2_REQUIREMENT,
1013 requirements.DIRSTATE_V2_REQUIREMENT,
973 }
1014 }
974 for name in compression.compengines:
1015 for name in compression.compengines:
975 engine = compression.compengines[name]
1016 engine = compression.compengines[name]
@@ -30,6 +30,7 b' from ..revlogutils import ('
30 nodemap,
30 nodemap,
31 sidedata as sidedatamod,
31 sidedata as sidedatamod,
32 )
32 )
33 from . import actions as upgrade_actions
33
34
34
35
35 def get_sidedata_helpers(srcrepo, dstrepo):
36 def get_sidedata_helpers(srcrepo, dstrepo):
@@ -458,6 +459,19 b' def upgrade(ui, srcrepo, dstrepo, upgrad'
458 )
459 )
459 )
460 )
460
461
462 if upgrade_actions.dirstatev2 in upgrade_op.upgrade_actions:
463 ui.status(_(b'upgrading to dirstate-v2 from v1\n'))
464 upgrade_dirstate(ui, srcrepo, upgrade_op, b'v1', b'v2')
465 upgrade_op.upgrade_actions.remove(upgrade_actions.dirstatev2)
466
467 if upgrade_actions.dirstatev2 in upgrade_op.removed_actions:
468 ui.status(_(b'downgrading from dirstate-v2 to v1\n'))
469 upgrade_dirstate(ui, srcrepo, upgrade_op, b'v2', b'v1')
470 upgrade_op.removed_actions.remove(upgrade_actions.dirstatev2)
471
472 if not (upgrade_op.upgrade_actions or upgrade_op.removed_actions):
473 return
474
461 if upgrade_op.requirements_only:
475 if upgrade_op.requirements_only:
462 ui.status(_(b'upgrading repository requirements\n'))
476 ui.status(_(b'upgrading repository requirements\n'))
463 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
477 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
@@ -466,7 +480,7 b' def upgrade(ui, srcrepo, dstrepo, upgrad'
466 # through the whole cloning process
480 # through the whole cloning process
467 elif (
481 elif (
468 len(upgrade_op.upgrade_actions) == 1
482 len(upgrade_op.upgrade_actions) == 1
469 and b'persistent-nodemap' in upgrade_op._upgrade_actions_names
483 and b'persistent-nodemap' in upgrade_op.upgrade_actions_names
470 and not upgrade_op.removed_actions
484 and not upgrade_op.removed_actions
471 ):
485 ):
472 ui.status(
486 ui.status(
@@ -591,3 +605,28 b' def upgrade(ui, srcrepo, dstrepo, upgrad'
591 backupvfs.unlink(b'store/lock')
605 backupvfs.unlink(b'store/lock')
592
606
593 return backuppath
607 return backuppath
608
609
610 def upgrade_dirstate(ui, srcrepo, upgrade_op, old, new):
611 if upgrade_op.backup_store:
612 backuppath = pycompat.mkdtemp(
613 prefix=b'upgradebackup.', dir=srcrepo.path
614 )
615 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
616 backupvfs = vfsmod.vfs(backuppath)
617 util.copyfile(
618 srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires')
619 )
620 util.copyfile(
621 srcrepo.vfs.join(b'dirstate'), backupvfs.join(b'dirstate')
622 )
623
624 assert srcrepo.dirstate._use_dirstate_v2 == (old == b'v2')
625 srcrepo.dirstate._map._use_dirstate_tree = True
626 srcrepo.dirstate._map.preload()
627 srcrepo.dirstate._use_dirstate_v2 = new == b'v2'
628 srcrepo.dirstate._map._use_dirstate_v2 = srcrepo.dirstate._use_dirstate_v2
629 srcrepo.dirstate._dirty = True
630 srcrepo.dirstate.write(None)
631
632 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
@@ -1652,6 +1652,7 b' We upgrade a repository that is not usin'
1652 $ hg debugformat -v
1652 $ hg debugformat -v
1653 format-variant repo config default
1653 format-variant repo config default
1654 fncache: yes yes yes
1654 fncache: yes yes yes
1655 dirstate-v2: no no no
1655 dotencode: yes yes yes
1656 dotencode: yes yes yes
1656 generaldelta: yes yes yes
1657 generaldelta: yes yes yes
1657 share-safe: no no no
1658 share-safe: no no no
@@ -1691,6 +1692,7 b' We upgrade a repository that is not usin'
1691 $ hg debugformat -v
1692 $ hg debugformat -v
1692 format-variant repo config default
1693 format-variant repo config default
1693 fncache: yes yes yes
1694 fncache: yes yes yes
1695 dirstate-v2: no no no
1694 dotencode: yes yes yes
1696 dotencode: yes yes yes
1695 generaldelta: yes yes yes
1697 generaldelta: yes yes yes
1696 share-safe: no no no
1698 share-safe: no no no
@@ -35,6 +35,7 b' Check that copies are recorded correctly'
35 $ hg debugformat -v
35 $ hg debugformat -v
36 format-variant repo config default
36 format-variant repo config default
37 fncache: yes yes yes
37 fncache: yes yes yes
38 dirstate-v2: no no no
38 dotencode: yes yes yes
39 dotencode: yes yes yes
39 generaldelta: yes yes yes
40 generaldelta: yes yes yes
40 share-safe: no no no
41 share-safe: no no no
@@ -52,6 +53,7 b' Check that copies are recorded correctly'
52 $ hg debugformat -v
53 $ hg debugformat -v
53 format-variant repo config default
54 format-variant repo config default
54 fncache: yes yes yes
55 fncache: yes yes yes
56 dirstate-v2: no no no
55 dotencode: yes yes yes
57 dotencode: yes yes yes
56 generaldelta: yes yes yes
58 generaldelta: yes yes yes
57 share-safe: no no no
59 share-safe: no no no
@@ -426,6 +428,7 b' downgrading'
426 $ hg debugformat -v
428 $ hg debugformat -v
427 format-variant repo config default
429 format-variant repo config default
428 fncache: yes yes yes
430 fncache: yes yes yes
431 dirstate-v2: no no no
429 dotencode: yes yes yes
432 dotencode: yes yes yes
430 generaldelta: yes yes yes
433 generaldelta: yes yes yes
431 share-safe: no no no
434 share-safe: no no no
@@ -456,6 +459,7 b' downgrading'
456 $ hg debugformat -v
459 $ hg debugformat -v
457 format-variant repo config default
460 format-variant repo config default
458 fncache: yes yes yes
461 fncache: yes yes yes
462 dirstate-v2: no no no
459 dotencode: yes yes yes
463 dotencode: yes yes yes
460 generaldelta: yes yes yes
464 generaldelta: yes yes yes
461 share-safe: no no no
465 share-safe: no no no
@@ -483,6 +487,7 b' upgrading'
483 $ hg debugformat -v
487 $ hg debugformat -v
484 format-variant repo config default
488 format-variant repo config default
485 fncache: yes yes yes
489 fncache: yes yes yes
490 dirstate-v2: no no no
486 dotencode: yes yes yes
491 dotencode: yes yes yes
487 generaldelta: yes yes yes
492 generaldelta: yes yes yes
488 share-safe: no no no
493 share-safe: no no no
@@ -57,6 +57,7 b' As a result, -1 passed from Rust for the'
57 $ hg debugformat
57 $ hg debugformat
58 format-variant repo
58 format-variant repo
59 fncache: yes
59 fncache: yes
60 dirstate-v2: no
60 dotencode: yes
61 dotencode: yes
61 generaldelta: yes
62 generaldelta: yes
62 share-safe: no
63 share-safe: no
@@ -577,6 +578,7 b' downgrading'
577 $ hg debugformat -v
578 $ hg debugformat -v
578 format-variant repo config default
579 format-variant repo config default
579 fncache: yes yes yes
580 fncache: yes yes yes
581 dirstate-v2: no no no
580 dotencode: yes yes yes
582 dotencode: yes yes yes
581 generaldelta: yes yes yes
583 generaldelta: yes yes yes
582 share-safe: no no no
584 share-safe: no no no
@@ -626,6 +628,7 b' upgrading'
626 $ hg debugformat -v
628 $ hg debugformat -v
627 format-variant repo config default
629 format-variant repo config default
628 fncache: yes yes yes
630 fncache: yes yes yes
631 dirstate-v2: no no no
629 dotencode: yes yes yes
632 dotencode: yes yes yes
630 generaldelta: yes yes yes
633 generaldelta: yes yes yes
631 share-safe: no no no
634 share-safe: no no no
@@ -52,6 +52,7 b' Check that we can upgrade to sidedata'
52 $ hg debugformat -v -R up-no-side-data
52 $ hg debugformat -v -R up-no-side-data
53 format-variant repo config default
53 format-variant repo config default
54 fncache: yes yes yes
54 fncache: yes yes yes
55 dirstate-v2: no no no
55 dotencode: yes yes yes
56 dotencode: yes yes yes
56 generaldelta: yes yes yes
57 generaldelta: yes yes yes
57 share-safe: no no no
58 share-safe: no no no
@@ -68,6 +69,7 b' Check that we can upgrade to sidedata'
68 $ hg debugformat -v -R up-no-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data
69 $ hg debugformat -v -R up-no-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data
69 format-variant repo config default
70 format-variant repo config default
70 fncache: yes yes yes
71 fncache: yes yes yes
72 dirstate-v2: no no no
71 dotencode: yes yes yes
73 dotencode: yes yes yes
72 generaldelta: yes yes yes
74 generaldelta: yes yes yes
73 share-safe: no no no
75 share-safe: no no no
@@ -90,6 +92,7 b' Check that we can downgrade from sidedat'
90 $ hg debugformat -v -R up-side-data
92 $ hg debugformat -v -R up-side-data
91 format-variant repo config default
93 format-variant repo config default
92 fncache: yes yes yes
94 fncache: yes yes yes
95 dirstate-v2: no no no
93 dotencode: yes yes yes
96 dotencode: yes yes yes
94 generaldelta: yes yes yes
97 generaldelta: yes yes yes
95 share-safe: no no no
98 share-safe: no no no
@@ -106,6 +109,7 b' Check that we can downgrade from sidedat'
106 $ hg debugformat -v -R up-side-data --config experimental.revlogv2=no
109 $ hg debugformat -v -R up-side-data --config experimental.revlogv2=no
107 format-variant repo config default
110 format-variant repo config default
108 fncache: yes yes yes
111 fncache: yes yes yes
112 dirstate-v2: no no no
109 dotencode: yes yes yes
113 dotencode: yes yes yes
110 generaldelta: yes yes yes
114 generaldelta: yes yes yes
111 share-safe: no no no
115 share-safe: no no no
@@ -57,6 +57,7 b' An upgrade of a repository created with '
57 $ hg debugformat
57 $ hg debugformat
58 format-variant repo
58 format-variant repo
59 fncache: yes
59 fncache: yes
60 dirstate-v2: no
60 dotencode: yes
61 dotencode: yes
61 generaldelta: yes
62 generaldelta: yes
62 share-safe: no
63 share-safe: no
@@ -72,6 +73,7 b' An upgrade of a repository created with '
72 $ hg debugformat --verbose
73 $ hg debugformat --verbose
73 format-variant repo config default
74 format-variant repo config default
74 fncache: yes yes yes
75 fncache: yes yes yes
76 dirstate-v2: no no no
75 dotencode: yes yes yes
77 dotencode: yes yes yes
76 generaldelta: yes yes yes
78 generaldelta: yes yes yes
77 share-safe: no no no
79 share-safe: no no no
@@ -88,6 +90,7 b' An upgrade of a repository created with '
88 $ hg debugformat --verbose --config format.usefncache=no
90 $ hg debugformat --verbose --config format.usefncache=no
89 format-variant repo config default
91 format-variant repo config default
90 fncache: yes no yes
92 fncache: yes no yes
93 dirstate-v2: no no no
91 dotencode: yes no yes
94 dotencode: yes no yes
92 generaldelta: yes yes yes
95 generaldelta: yes yes yes
93 share-safe: no no no
96 share-safe: no no no
@@ -104,6 +107,7 b' An upgrade of a repository created with '
104 $ hg debugformat --verbose --config format.usefncache=no --color=debug
107 $ hg debugformat --verbose --config format.usefncache=no --color=debug
105 format-variant repo config default
108 format-variant repo config default
106 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
109 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
110 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
107 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
111 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
108 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
112 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
109 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
113 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
@@ -126,6 +130,12 b' An upgrade of a repository created with '
126 "repo": true
130 "repo": true
127 },
131 },
128 {
132 {
133 "config": false,
134 "default": false,
135 "name": "dirstate-v2",
136 "repo": false
137 },
138 {
129 "config": true,
139 "config": true,
130 "default": true,
140 "default": true,
131 "name": "dotencode",
141 "name": "dotencode",
@@ -327,6 +337,7 b' Various sub-optimal detections work'
327 $ hg debugformat
337 $ hg debugformat
328 format-variant repo
338 format-variant repo
329 fncache: no
339 fncache: no
340 dirstate-v2: no
330 dotencode: no
341 dotencode: no
331 generaldelta: no
342 generaldelta: no
332 share-safe: no
343 share-safe: no
@@ -341,6 +352,7 b' Various sub-optimal detections work'
341 $ hg debugformat --verbose
352 $ hg debugformat --verbose
342 format-variant repo config default
353 format-variant repo config default
343 fncache: no yes yes
354 fncache: no yes yes
355 dirstate-v2: no no no
344 dotencode: no yes yes
356 dotencode: no yes yes
345 generaldelta: no yes yes
357 generaldelta: no yes yes
346 share-safe: no no no
358 share-safe: no no no
@@ -357,6 +369,7 b' Various sub-optimal detections work'
357 $ hg debugformat --verbose --config format.usegeneraldelta=no
369 $ hg debugformat --verbose --config format.usegeneraldelta=no
358 format-variant repo config default
370 format-variant repo config default
359 fncache: no yes yes
371 fncache: no yes yes
372 dirstate-v2: no no no
360 dotencode: no yes yes
373 dotencode: no yes yes
361 generaldelta: no no yes
374 generaldelta: no no yes
362 share-safe: no no no
375 share-safe: no no no
@@ -373,6 +386,7 b' Various sub-optimal detections work'
373 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
386 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
374 format-variant repo config default
387 format-variant repo config default
375 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
388 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
389 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
376 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
390 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
377 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
391 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
378 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
392 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
@@ -1355,6 +1369,7 b' upgrade'
1355 $ hg debugformat -v
1369 $ hg debugformat -v
1356 format-variant repo config default
1370 format-variant repo config default
1357 fncache: yes yes yes
1371 fncache: yes yes yes
1372 dirstate-v2: no no no
1358 dotencode: yes yes yes
1373 dotencode: yes yes yes
1359 generaldelta: yes yes yes
1374 generaldelta: yes yes yes
1360 share-safe: no no no
1375 share-safe: no no no
@@ -1396,6 +1411,7 b' downgrade'
1396 $ hg debugformat -v
1411 $ hg debugformat -v
1397 format-variant repo config default
1412 format-variant repo config default
1398 fncache: yes yes yes
1413 fncache: yes yes yes
1414 dirstate-v2: no no no
1399 dotencode: yes yes yes
1415 dotencode: yes yes yes
1400 generaldelta: yes yes yes
1416 generaldelta: yes yes yes
1401 share-safe: no no no
1417 share-safe: no no no
@@ -1440,6 +1456,7 b' upgrade from hgrc'
1440 $ hg debugformat -v
1456 $ hg debugformat -v
1441 format-variant repo config default
1457 format-variant repo config default
1442 fncache: yes yes yes
1458 fncache: yes yes yes
1459 dirstate-v2: no no no
1443 dotencode: yes yes yes
1460 dotencode: yes yes yes
1444 generaldelta: yes yes yes
1461 generaldelta: yes yes yes
1445 share-safe: no no no
1462 share-safe: no no no
@@ -1490,6 +1507,7 b' upgrade'
1490 $ hg debugformat -v
1507 $ hg debugformat -v
1491 format-variant repo config default
1508 format-variant repo config default
1492 fncache: yes yes yes
1509 fncache: yes yes yes
1510 dirstate-v2: no no no
1493 dotencode: yes yes yes
1511 dotencode: yes yes yes
1494 generaldelta: yes yes yes
1512 generaldelta: yes yes yes
1495 share-safe: no no no
1513 share-safe: no no no
@@ -1537,6 +1555,7 b' downgrade'
1537 $ hg debugformat -v
1555 $ hg debugformat -v
1538 format-variant repo config default
1556 format-variant repo config default
1539 fncache: yes yes yes
1557 fncache: yes yes yes
1558 dirstate-v2: no no no
1540 dotencode: yes yes yes
1559 dotencode: yes yes yes
1541 generaldelta: yes yes yes
1560 generaldelta: yes yes yes
1542 share-safe: no no no
1561 share-safe: no no no
@@ -1585,6 +1604,7 b' upgrade from hgrc'
1585 $ hg debugformat -v
1604 $ hg debugformat -v
1586 format-variant repo config default
1605 format-variant repo config default
1587 fncache: yes yes yes
1606 fncache: yes yes yes
1607 dirstate-v2: no no no
1588 dotencode: yes yes yes
1608 dotencode: yes yes yes
1589 generaldelta: yes yes yes
1609 generaldelta: yes yes yes
1590 share-safe: no no no
1610 share-safe: no no no
@@ -1613,3 +1633,105 b' Demonstrate that nothing to perform upgr'
1613
1633
1614 $ hg debugupgraderepo --run
1634 $ hg debugupgraderepo --run
1615 nothing to do
1635 nothing to do
1636
1637 #if rust
1638
1639 Upgrade to dirstate-v2
1640
1641 $ hg debugformat -v --config format.exp-dirstate-v2=1
1642 format-variant repo config default
1643 fncache: yes yes yes
1644 dirstate-v2: no yes no
1645 dotencode: yes yes yes
1646 generaldelta: yes yes yes
1647 share-safe: no no no
1648 sparserevlog: yes yes yes
1649 persistent-nodemap: yes yes no
1650 copies-sdc: no no no
1651 revlog-v2: yes yes no
1652 changelog-v2: no no no
1653 plain-cl-delta: yes yes yes
1654 compression: zstd zstd zstd
1655 compression-level: default default default
1656 $ hg debugupgraderepo --config format.exp-dirstate-v2=1 --run
1657 upgrade will perform the following actions:
1658
1659 requirements
1660 preserved: dotencode, exp-revlogv2.2, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, sparserevlog, store
1661 added: exp-dirstate-v2
1662
1663 dirstate-v2
1664 "hg status" will be faster
1665
1666 processed revlogs:
1667 - all-filelogs
1668 - changelog
1669 - manifest
1670
1671 beginning upgrade...
1672 repository locked and read-only
1673 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1674 (it is safe to interrupt this process any time before data migration completes)
1675 upgrading to dirstate-v2 from v1
1676 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1677 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1678 $ ls .hg/upgradebackup.*/dirstate
1679 .hg/upgradebackup.*/dirstate (glob)
1680 $ hg debugformat -v
1681 format-variant repo config default
1682 fncache: yes yes yes
1683 dirstate-v2: yes no no
1684 dotencode: yes yes yes
1685 generaldelta: yes yes yes
1686 share-safe: no no no
1687 sparserevlog: yes yes yes
1688 persistent-nodemap: yes yes no
1689 copies-sdc: no no no
1690 revlog-v2: yes yes no
1691 changelog-v2: no no no
1692 plain-cl-delta: yes yes yes
1693 compression: zstd zstd zstd
1694 compression-level: default default default
1695 $ hg status
1696 $ dd status=none bs=12 count=1 if=.hg/dirstate
1697 dirstate-v2
1698
1699 Downgrade from dirstate-v2
1700
1701 $ hg debugupgraderepo --run
1702 upgrade will perform the following actions:
1703
1704 requirements
1705 preserved: dotencode, exp-revlogv2.2, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, sparserevlog, store
1706 removed: exp-dirstate-v2
1707
1708 processed revlogs:
1709 - all-filelogs
1710 - changelog
1711 - manifest
1712
1713 beginning upgrade...
1714 repository locked and read-only
1715 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1716 (it is safe to interrupt this process any time before data migration completes)
1717 downgrading from dirstate-v2 to v1
1718 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1719 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1720 $ hg debugformat -v
1721 format-variant repo config default
1722 fncache: yes yes yes
1723 dirstate-v2: no no no
1724 dotencode: yes yes yes
1725 generaldelta: yes yes yes
1726 share-safe: no no no
1727 sparserevlog: yes yes yes
1728 persistent-nodemap: yes yes no
1729 copies-sdc: no no no
1730 revlog-v2: yes yes no
1731 changelog-v2: no no no
1732 plain-cl-delta: yes yes yes
1733 compression: zstd zstd zstd
1734 compression-level: default default default
1735 $ hg status
1736
1737 #endif
General Comments 0
You need to be logged in to leave comments. Login now