##// END OF EJS Templates
dirstate-v2: Add `hg debugupgraderepo` command support...
Simon Sapin -
r48098:7587bdf3 default draft
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:
@@ -81,7 +81,7 b' class improvement(object):'
81 postdowngrademessage = None
81 postdowngrademessage = None
82
82
83
83
84 # By default for now, we assume every improvement touches all the things
84 # By default we assume that every improvement touches requirements and all revlogs
85
85
86 # Whether this improvement touches filelogs
86 # Whether this improvement touches filelogs
87 touches_filelogs = True
87 touches_filelogs = True
@@ -95,6 +95,9 b' class improvement(object):'
95 # Whether this improvement changes repository requirements
95 # Whether this improvement changes repository requirements
96 touches_requirements = True
96 touches_requirements = True
97
97
98 # Whether this improvement touches the dirstate
99 touches_dirstate = False
100
98
101
99 allformatvariant = [] # type: List[Type['formatvariant']]
102 allformatvariant = [] # type: List[Type['formatvariant']]
100
103
@@ -168,6 +171,27 b' class fncache(requirementformatvariant):'
168
171
169
172
170 @registerformatvariant
173 @registerformatvariant
174 class dirstatev2(requirementformatvariant):
175 name = b'dirstate-v2'
176 _requirement = requirements.DIRSTATE_V2_REQUIREMENT
177
178 default = False
179
180 description = _(
181 b'version 1 of the dirstate file format requires '
182 b'reading and parsing it all at once.'
183 )
184
185 upgrademessage = _(b'"hg status" will be faster')
186
187 touches_filelogs = False
188 touches_manifests = False
189 touches_changelog = False
190 touches_requirements = True
191 touches_dirstate = True
192
193
194 @registerformatvariant
171 class dotencode(requirementformatvariant):
195 class dotencode(requirementformatvariant):
172 name = b'dotencode'
196 name = b'dotencode'
173
197
@@ -645,7 +669,6 b' class UpgradeOperation(object):'
645 self.current_requirements = current_requirements
669 self.current_requirements = current_requirements
646 # list of upgrade actions the operation will perform
670 # list of upgrade actions the operation will perform
647 self.upgrade_actions = upgrade_actions
671 self.upgrade_actions = upgrade_actions
648 self._upgrade_actions_names = set([a.name for a in upgrade_actions])
649 self.removed_actions = removed_actions
672 self.removed_actions = removed_actions
650 self.revlogs_to_process = revlogs_to_process
673 self.revlogs_to_process = revlogs_to_process
651 # requirements which will be added by the operation
674 # requirements which will be added by the operation
@@ -668,41 +691,42 b' class UpgradeOperation(object):'
668 ]
691 ]
669
692
670 # delta reuse mode of this upgrade operation
693 # delta reuse mode of this upgrade operation
694 upgrade_actions_names = self.upgrade_actions_names
671 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
695 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
672 if b're-delta-all' in self._upgrade_actions_names:
696 if b're-delta-all' in upgrade_actions_names:
673 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
697 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
674 elif b're-delta-parent' in self._upgrade_actions_names:
698 elif b're-delta-parent' in upgrade_actions_names:
675 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
699 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
676 elif b're-delta-multibase' in self._upgrade_actions_names:
700 elif b're-delta-multibase' in upgrade_actions_names:
677 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
701 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
678 elif b're-delta-fulladd' in self._upgrade_actions_names:
702 elif b're-delta-fulladd' in upgrade_actions_names:
679 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
703 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
680
704
681 # should this operation force re-delta of both parents
705 # should this operation force re-delta of both parents
682 self.force_re_delta_both_parents = (
706 self.force_re_delta_both_parents = (
683 b're-delta-multibase' in self._upgrade_actions_names
707 b're-delta-multibase' in upgrade_actions_names
684 )
708 )
685
709
686 # should this operation create a backup of the store
710 # should this operation create a backup of the store
687 self.backup_store = backup_store
711 self.backup_store = backup_store
688
712
689 # whether the operation touches different revlogs at all or not
713 @property
690 self.touches_filelogs = self._touches_filelogs()
714 def upgrade_actions_names(self):
691 self.touches_manifests = self._touches_manifests()
715 return set([a.name for a in self.upgrade_actions])
692 self.touches_changelog = self._touches_changelog()
716
693 # whether the operation touches requirements file or not
717 @property
694 self.touches_requirements = self._touches_requirements()
718 def requirements_only(self):
695 self.touches_store = (
696 self.touches_filelogs
697 or self.touches_manifests
698 or self.touches_changelog
699 )
700 # does the operation only touches repository requirement
719 # does the operation only touches repository requirement
701 self.requirements_only = (
720 return (
702 self.touches_requirements and not self.touches_store
721 self.touches_requirements
722 and not self.touches_filelogs
723 and not self.touches_manifests
724 and not self.touches_changelog
725 and not self.touches_dirstate
703 )
726 )
704
727
705 def _touches_filelogs(self):
728 @property
729 def touches_filelogs(self):
706 for a in self.upgrade_actions:
730 for a in self.upgrade_actions:
707 # in optimisations, we re-process the revlogs again
731 # in optimisations, we re-process the revlogs again
708 if a.type == OPTIMISATION:
732 if a.type == OPTIMISATION:
@@ -714,7 +738,8 b' class UpgradeOperation(object):'
714 return True
738 return True
715 return False
739 return False
716
740
717 def _touches_manifests(self):
741 @property
742 def touches_manifests(self):
718 for a in self.upgrade_actions:
743 for a in self.upgrade_actions:
719 # in optimisations, we re-process the revlogs again
744 # in optimisations, we re-process the revlogs again
720 if a.type == OPTIMISATION:
745 if a.type == OPTIMISATION:
@@ -726,7 +751,8 b' class UpgradeOperation(object):'
726 return True
751 return True
727 return False
752 return False
728
753
729 def _touches_changelog(self):
754 @property
755 def touches_changelog(self):
730 for a in self.upgrade_actions:
756 for a in self.upgrade_actions:
731 # in optimisations, we re-process the revlogs again
757 # in optimisations, we re-process the revlogs again
732 if a.type == OPTIMISATION:
758 if a.type == OPTIMISATION:
@@ -738,7 +764,8 b' class UpgradeOperation(object):'
738 return True
764 return True
739 return False
765 return False
740
766
741 def _touches_requirements(self):
767 @property
768 def touches_requirements(self):
742 for a in self.upgrade_actions:
769 for a in self.upgrade_actions:
743 # optimisations are used to re-process revlogs and does not result
770 # optimisations are used to re-process revlogs and does not result
744 # in a requirement being added or removed
771 # in a requirement being added or removed
@@ -750,6 +777,18 b' class UpgradeOperation(object):'
750 if a.touches_requirements:
777 if a.touches_requirements:
751 return True
778 return True
752
779
780 @property
781 def touches_dirstate(self):
782 for a in self.upgrade_actions:
783 # revlog optimisations do not affect the dirstate
784 if a.type == OPTIMISATION:
785 pass
786 elif a.touches_dirstate:
787 return True
788 for a in self.removed_actions:
789 if a.touches_dirstate:
790 return True
791
753 return False
792 return False
754
793
755 def _write_labeled(self, l, label):
794 def _write_labeled(self, l, label):
@@ -909,6 +948,7 b' def supportremovedrequirements(repo):'
909 requirements.REVLOGV2_REQUIREMENT,
948 requirements.REVLOGV2_REQUIREMENT,
910 requirements.CHANGELOGV2_REQUIREMENT,
949 requirements.CHANGELOGV2_REQUIREMENT,
911 requirements.REVLOGV1_REQUIREMENT,
950 requirements.REVLOGV1_REQUIREMENT,
951 requirements.DIRSTATE_V2_REQUIREMENT,
912 }
952 }
913 for name in compression.compengines:
953 for name in compression.compengines:
914 engine = compression.compengines[name]
954 engine = compression.compengines[name]
@@ -971,6 +1011,7 b' def allowednewrequirements(repo):'
971 requirements.REVLOGV1_REQUIREMENT,
1011 requirements.REVLOGV1_REQUIREMENT,
972 requirements.REVLOGV2_REQUIREMENT,
1012 requirements.REVLOGV2_REQUIREMENT,
973 requirements.CHANGELOGV2_REQUIREMENT,
1013 requirements.CHANGELOGV2_REQUIREMENT,
1014 requirements.DIRSTATE_V2_REQUIREMENT,
974 }
1015 }
975 for name in compression.compengines:
1016 for name in compression.compengines:
976 engine = compression.compengines[name]
1017 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