##// END OF EJS Templates
upgrade: start moving the "to be happening" data in a dedicated object...
marmoute -
r46671:74923cb8 default draft
parent child Browse files
Show More
@@ -176,6 +176,12 b' def upgraderepo('
176 ui.write((b' - %s\n' % r))
176 ui.write((b' - %s\n' % r))
177 ui.write((b'\n'))
177 ui.write((b'\n'))
178
178
179 upgrade_op = upgrade_actions.UpgradeOperation(
180 newreqs,
181 [a.name for a in actions],
182 revlogs,
183 )
184
179 if not run:
185 if not run:
180 fromconfig = []
186 fromconfig = []
181 onlydefault = []
187 onlydefault = []
@@ -249,8 +255,6 b' def upgraderepo('
249 printupgradeactions()
255 printupgradeactions()
250 print_affected_revlogs()
256 print_affected_revlogs()
251
257
252 upgradeactions = [a.name for a in actions]
253
254 ui.status(_(b'beginning upgrade...\n'))
258 ui.status(_(b'beginning upgrade...\n'))
255 with repo.wlock(), repo.lock():
259 with repo.wlock(), repo.lock():
256 ui.status(_(b'repository locked and read-only\n'))
260 ui.status(_(b'repository locked and read-only\n'))
@@ -276,7 +280,7 b' def upgraderepo('
276
280
277 with dstrepo.wlock(), dstrepo.lock():
281 with dstrepo.wlock(), dstrepo.lock():
278 backuppath = upgrade_engine.upgrade(
282 backuppath = upgrade_engine.upgrade(
279 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
283 ui, repo, dstrepo, upgrade_op
280 )
284 )
281 if not (backup or backuppath is None):
285 if not (backup or backuppath is None):
282 ui.status(
286 ui.status(
@@ -554,6 +554,15 b' def determineactions(repo, deficiencies,'
554 return newactions
554 return newactions
555
555
556
556
557 class UpgradeOperation(object):
558 """represent the work to be done during an upgrade"""
559
560 def __init__(self, requirements, actions, revlogs_to_process):
561 self.requirements = requirements
562 self.actions = actions
563 self.revlogs_to_process = revlogs_to_process
564
565
557 ### Code checking if a repository can got through the upgrade process at all. #
566 ### Code checking if a repository can got through the upgrade process at all. #
558
567
559
568
@@ -383,9 +383,7 b' def _finishdatamigration(ui, srcrepo, ds'
383 """
383 """
384
384
385
385
386 def upgrade(
386 def upgrade(ui, srcrepo, dstrepo, upgrade_op):
387 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS
388 ):
389 """Do the low-level work of upgrading a repository.
387 """Do the low-level work of upgrading a repository.
390
388
391 The upgrade is effectively performed as a copy between a source
389 The upgrade is effectively performed as a copy between a source
@@ -405,13 +403,13 b' def upgrade('
405 )
403 )
406 )
404 )
407
405
408 if b're-delta-all' in actions:
406 if b're-delta-all' in upgrade_op.actions:
409 deltareuse = revlog.revlog.DELTAREUSENEVER
407 deltareuse = revlog.revlog.DELTAREUSENEVER
410 elif b're-delta-parent' in actions:
408 elif b're-delta-parent' in upgrade_op.actions:
411 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
409 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
412 elif b're-delta-multibase' in actions:
410 elif b're-delta-multibase' in upgrade_op.actions:
413 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
411 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
414 elif b're-delta-fulladd' in actions:
412 elif b're-delta-fulladd' in upgrade_op.actions:
415 deltareuse = revlog.revlog.DELTAREUSEFULLADD
413 deltareuse = revlog.revlog.DELTAREUSEFULLADD
416 else:
414 else:
417 deltareuse = revlog.revlog.DELTAREUSEALWAYS
415 deltareuse = revlog.revlog.DELTAREUSEALWAYS
@@ -423,14 +421,16 b' def upgrade('
423 dstrepo,
421 dstrepo,
424 tr,
422 tr,
425 deltareuse,
423 deltareuse,
426 b're-delta-multibase' in actions,
424 b're-delta-multibase' in upgrade_op.actions,
427 revlogs=revlogs,
425 revlogs=upgrade_op.revlogs_to_process,
428 )
426 )
429
427
430 # Now copy other files in the store directory.
428 # Now copy other files in the store directory.
431 # The sorted() makes execution deterministic.
429 # The sorted() makes execution deterministic.
432 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
430 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
433 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st):
431 if not _filterstorefile(
432 srcrepo, dstrepo, upgrade_op.requirements, p, kind, st
433 ):
434 continue
434 continue
435
435
436 srcrepo.ui.status(_(b'copying %s\n') % p)
436 srcrepo.ui.status(_(b'copying %s\n') % p)
@@ -489,7 +489,7 b' def upgrade('
489 b'again\n'
489 b'again\n'
490 )
490 )
491 )
491 )
492 scmutil.writereporequirements(srcrepo, requirements)
492 scmutil.writereporequirements(srcrepo, upgrade_op.requirements)
493
493
494 # The lock file from the old store won't be removed because nothing has a
494 # The lock file from the old store won't be removed because nothing has a
495 # reference to its new location. So clean it up manually. Alternatively, we
495 # reference to its new location. So clean it up manually. Alternatively, we
General Comments 0
You need to be logged in to leave comments. Login now