comparison mercurial/upgrade.py @ 43134:75ad8af9c95e

upgrade: allow upgrade to repository using sidedata Repository can now be migrated to support sidedata. More requirements and migration will be needed to actual side-data usage. This is a step in that direction. To test the feature, we leverage the test extension. It make sure the `update` part of the side-data migration actually works. Differential Revision: https://phab.mercurial-scm.org/D6942
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 06 Oct 2019 23:36:51 -0400
parents 8ff1ecfadcd1
children 6e3dc1eff5c7
comparison
equal deleted inserted replaced
43133:3de4d13f22be 43134:75ad8af9c95e
29 29
30 # list of requirements that request a clone of all revlog if added/removed 30 # list of requirements that request a clone of all revlog if added/removed
31 RECLONES_REQUIREMENTS = { 31 RECLONES_REQUIREMENTS = {
32 b'generaldelta', 32 b'generaldelta',
33 localrepo.SPARSEREVLOG_REQUIREMENT, 33 localrepo.SPARSEREVLOG_REQUIREMENT,
34 localrepo.SIDEDATA_REQUIREMENT,
34 } 35 }
35 36
36 37
37 def requiredsourcerequirements(repo): 38 def requiredsourcerequirements(repo):
38 """Obtain requirements required to be present to upgrade a repo. 39 """Obtain requirements required to be present to upgrade a repo.
98 b'fncache', 99 b'fncache',
99 b'generaldelta', 100 b'generaldelta',
100 b'revlogv1', 101 b'revlogv1',
101 b'store', 102 b'store',
102 localrepo.SPARSEREVLOG_REQUIREMENT, 103 localrepo.SPARSEREVLOG_REQUIREMENT,
104 localrepo.SIDEDATA_REQUIREMENT,
103 } 105 }
104 for name in compression.compengines: 106 for name in compression.compengines:
105 engine = compression.compengines[name] 107 engine = compression.compengines[name]
106 if engine.available() and engine.revlogheader(): 108 if engine.available() and engine.revlogheader():
107 supported.add(b'exp-compression-%s' % name) 109 supported.add(b'exp-compression-%s' % name)
123 supported = { 125 supported = {
124 b'dotencode', 126 b'dotencode',
125 b'fncache', 127 b'fncache',
126 b'generaldelta', 128 b'generaldelta',
127 localrepo.SPARSEREVLOG_REQUIREMENT, 129 localrepo.SPARSEREVLOG_REQUIREMENT,
130 localrepo.SIDEDATA_REQUIREMENT,
128 } 131 }
129 for name in compression.compengines: 132 for name in compression.compengines:
130 engine = compression.compengines[name] 133 engine = compression.compengines[name]
131 if engine.available() and engine.revlogheader(): 134 if engine.available() and engine.revlogheader():
132 supported.add(b'exp-compression-%s' % name) 135 supported.add(b'exp-compression-%s' % name)
672 UPGRADE_FILELOG = object() 675 UPGRADE_FILELOG = object()
673 676
674 UPGRADE_ALL_REVLOGS = frozenset( 677 UPGRADE_ALL_REVLOGS = frozenset(
675 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG] 678 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG]
676 ) 679 )
680
681
682 def getsidedatacompanion(srcrepo, destrepo):
683 return None
677 684
678 685
679 def matchrevlog(revlogfilter, entry): 686 def matchrevlog(revlogfilter, entry):
680 """check is a revlog is selected for cloning 687 """check is a revlog is selected for cloning
681 688
777 progress = None 784 progress = None
778 785
779 def oncopiedrevision(rl, rev, node): 786 def oncopiedrevision(rl, rev, node):
780 progress.increment() 787 progress.increment()
781 788
789 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo)
790
782 # Do the actual copying. 791 # Do the actual copying.
783 # FUTURE this operation can be farmed off to worker processes. 792 # FUTURE this operation can be farmed off to worker processes.
784 seen = set() 793 seen = set()
785 for unencoded, encoded, size in alldatafiles: 794 for unencoded, encoded, size in alldatafiles:
786 if unencoded.endswith(b'.d'): 795 if unencoded.endswith(b'.d'):
868 tr, 877 tr,
869 newrl, 878 newrl,
870 addrevisioncb=oncopiedrevision, 879 addrevisioncb=oncopiedrevision,
871 deltareuse=deltareuse, 880 deltareuse=deltareuse,
872 forcedeltabothparents=forcedeltabothparents, 881 forcedeltabothparents=forcedeltabothparents,
882 sidedatacompanion=sidedatacompanion,
873 ) 883 )
874 else: 884 else:
875 msg = _(b'blindly copying %s containing %i revisions\n') 885 msg = _(b'blindly copying %s containing %i revisions\n')
876 ui.note(msg % (unencoded, len(oldrl))) 886 ui.note(msg % (unencoded, len(oldrl)))
877 _copyrevlog(tr, dstrepo, oldrl, unencoded) 887 _copyrevlog(tr, dstrepo, oldrl, unencoded)