Show More
@@ -128,13 +128,18 b' def update_persistent_nodemap(revlog):' | |||
|
128 | 128 | notr._postclose[k](None) |
|
129 | 129 | |
|
130 | 130 | |
|
131 | def persist_nodemap(tr, revlog, pending=False): | |
|
131 | def persist_nodemap(tr, revlog, pending=False, force=False): | |
|
132 | 132 | """Write nodemap data on disk for a given revlog""" |
|
133 | 133 | if getattr(revlog, 'filteredrevs', ()): |
|
134 | 134 | raise error.ProgrammingError( |
|
135 | 135 | "cannot persist nodemap of a filtered changelog" |
|
136 | 136 | ) |
|
137 | 137 | if revlog.nodemap_file is None: |
|
138 | if force: | |
|
139 | revlog.nodemap_file = get_nodemap_file( | |
|
140 | revlog.opener, revlog.indexfile | |
|
141 | ) | |
|
142 | else: | |
|
138 | 143 | msg = "calling persist nodemap on a revlog without the feature enabled" |
|
139 | 144 | raise error.ProgrammingError(msg) |
|
140 | 145 |
@@ -24,6 +24,7 b' from .. import (' | |||
|
24 | 24 | util, |
|
25 | 25 | vfs as vfsmod, |
|
26 | 26 | ) |
|
27 | from ..revlogutils import nodemap | |
|
27 | 28 | |
|
28 | 29 | |
|
29 | 30 | def _revlogfrompath(repo, path): |
@@ -452,6 +453,22 b' def upgrade(ui, srcrepo, dstrepo, upgrad' | |||
|
452 | 453 | if upgrade_op.requirements_only: |
|
453 | 454 | ui.status(_(b'upgrading repository requirements\n')) |
|
454 | 455 | scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements) |
|
456 | # if there is only one action and that is persistent nodemap upgrade | |
|
457 | # directly write the nodemap file and update requirements instead of going | |
|
458 | # through the whole cloning process | |
|
459 | elif ( | |
|
460 | len(upgrade_op.upgrade_actions) == 1 | |
|
461 | and b'persistent-nodemap' in upgrade_op._upgrade_actions_names | |
|
462 | and not upgrade_op.removed_actions | |
|
463 | ): | |
|
464 | ui.status( | |
|
465 | _(b'upgrading repository to use persistent nodemap feature\n') | |
|
466 | ) | |
|
467 | with srcrepo.transaction(b'upgrade') as tr: | |
|
468 | unfi = srcrepo.unfiltered() | |
|
469 | cl = unfi.changelog | |
|
470 | nodemap.persist_nodemap(tr, cl, force=True) | |
|
471 | scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements) | |
|
455 | 472 | else: |
|
456 | 473 | with dstrepo.transaction(b'upgrade') as tr: |
|
457 | 474 | _clonerevlogs( |
@@ -636,28 +636,11 b' upgrading' | |||
|
636 | 636 | repository locked and read-only |
|
637 | 637 | creating temporary repository to stage upgraded data: $TESTTMP/test-repo/.hg/upgrade.* (glob) |
|
638 | 638 | (it is safe to interrupt this process any time before data migration completes) |
|
639 | migrating 15018 total revisions (5006 in filelogs, 5006 in manifests, 5006 in changelog) | |
|
640 | migrating 1.74 MB in store; 569 MB tracked data | |
|
641 | migrating 5004 filelogs containing 5006 revisions (346 KB in store; 28.2 KB tracked data) | |
|
642 | finished migrating 5006 filelog revisions across 5004 filelogs; change in size: 0 bytes | |
|
643 | migrating 1 manifests containing 5006 revisions (765 KB in store; 569 MB tracked data) | |
|
644 | finished migrating 5006 manifest revisions across 1 manifests; change in size: 0 bytes | |
|
645 | migrating changelog containing 5006 revisions (673 KB in store; 363 KB tracked data) | |
|
646 | finished migrating 5006 changelog revisions; change in size: 0 bytes | |
|
647 | finished migrating 15018 total revisions; total change in store size: 0 bytes | |
|
648 | copying phaseroots | |
|
649 | data fully upgraded in a temporary repository | |
|
650 | marking source repository as being upgraded; clients will be unable to read from repository | |
|
651 | starting in-place swap of repository data | |
|
652 | replacing store... | |
|
653 | store replacement complete; repository was inconsistent for *s (glob) | |
|
654 | finalizing requirements file and making repository readable again | |
|
639 | upgrading repository to use persistent nodemap feature | |
|
655 | 640 | removing temporary repository $TESTTMP/test-repo/.hg/upgrade.* (glob) |
|
656 | 641 | $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)' |
|
657 | 642 | 00changelog-*.nd (glob) |
|
658 | 643 | 00changelog.n |
|
659 | 00manifest-*.nd (glob) | |
|
660 | 00manifest.n | |
|
661 | 644 | |
|
662 | 645 | $ hg debugnodemap --metadata |
|
663 | 646 | uid: * (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now