##// END OF EJS Templates
upgrade: introduce the internal code for revlog cloning selection...
marmoute -
r42921:0812d9fb default
parent child Browse files
Show More
@@ -562,7 +562,26 b' def _copyrevlog(tr, destrepo, oldrl, une'
562 562 or unencodedname.endswith('00manifest.i')):
563 563 destrepo.svfs.fncache.add(unencodedname)
564 564
565 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents):
565 UPGRADE_CHANGELOG = object()
566 UPGRADE_MANIFEST = object()
567 UPGRADE_FILELOG = object()
568
569 UPGRADE_ALL_REVLOGS = frozenset([UPGRADE_CHANGELOG,
570 UPGRADE_MANIFEST,
571 UPGRADE_FILELOG])
572
573 def matchrevlog(revlogfilter, entry):
574 """check is a revlog is selected for cloning
575
576 The store entry is checked against the passed filter"""
577 if entry.endswith('00changelog.i'):
578 return UPGRADE_CHANGELOG in revlogfilter
579 elif entry.endswith('00manifest.i'):
580 return UPGRADE_MANIFEST in revlogfilter
581 return UPGRADE_FILELOG in revlogfilter
582
583 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents,
584 revlogs=UPGRADE_ALL_REVLOGS):
566 585 """Copy revlogs between 2 repos."""
567 586 revcount = 0
568 587 srcsize = 0
@@ -643,7 +662,6 b' def _clonerevlogs(ui, srcrepo, dstrepo, '
643 662 continue
644 663
645 664 oldrl = _revlogfrompath(srcrepo, unencoded)
646 newrl = _revlogfrompath(dstrepo, unencoded)
647 665
648 666 if isinstance(oldrl, changelog.changelog) and 'c' not in seen:
649 667 ui.write(_('finished migrating %d manifest revisions across %d '
@@ -682,11 +700,19 b' def _clonerevlogs(ui, srcrepo, dstrepo, '
682 700 progress = srcrepo.ui.makeprogress(_('file revisions'),
683 701 total=frevcount)
684 702
703 if matchrevlog(revlogs, unencoded):
704 ui.note(_('cloning %d revisions from %s\n')
705 % (len(oldrl), unencoded))
706 newrl = _revlogfrompath(dstrepo, unencoded)
707 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision,
708 deltareuse=deltareuse,
709 forcedeltabothparents=forcedeltabothparents)
710 else:
711 msg = _('blindly copying %s containing %i revisions\n')
712 ui.note(msg % (unencoded, len(oldrl)))
713 _copyrevlog(tr, dstrepo, oldrl, unencoded)
685 714
686 ui.note(_('cloning %d revisions from %s\n') % (len(oldrl), unencoded))
687 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision,
688 deltareuse=deltareuse,
689 forcedeltabothparents=forcedeltabothparents)
715 newrl = _revlogfrompath(dstrepo, unencoded)
690 716
691 717 info = newrl.storageinfo(storedsize=True)
692 718 datasize = info['storedsize'] or 0
@@ -746,7 +772,8 b' def _finishdatamigration(ui, srcrepo, ds'
746 772 before the new store is swapped into the original location.
747 773 """
748 774
749 def _upgraderepo(ui, srcrepo, dstrepo, requirements, actions):
775 def _upgraderepo(ui, srcrepo, dstrepo, requirements, actions,
776 revlogs=UPGRADE_ALL_REVLOGS):
750 777 """Do the low-level work of upgrading a repository.
751 778
752 779 The upgrade is effectively performed as a copy between a source
@@ -775,7 +802,7 b' def _upgraderepo(ui, srcrepo, dstrepo, r'
775 802
776 803 with dstrepo.transaction('upgrade') as tr:
777 804 _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse,
778 're-delta-multibase' in actions)
805 're-delta-multibase' in actions, revlogs=revlogs)
779 806
780 807 # Now copy other files in the store directory.
781 808 # The sorted() makes execution deterministic.
General Comments 0
You need to be logged in to leave comments. Login now