Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/upgrade_utils/engine.py @ 48790:5ba24e886cec
tracked-key: make it possible to upgrade to and downgrade from the feature
This seems rather important if we want people to start using it.
Differential Revision: https://phab.mercurial-scm.org/D12198
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 17 Feb 2022 06:32:03 +0100 |
parents | 6e4999cb085e |
children | 6e559391f96e |
comparison
equal
deleted
inserted
replaced
48789:ef50a62eec40 | 48790:5ba24e886cec |
---|---|
484 if upgrade_actions.dirstatev2 in upgrade_op.removed_actions: | 484 if upgrade_actions.dirstatev2 in upgrade_op.removed_actions: |
485 ui.status(_(b'downgrading from dirstate-v2 to v1\n')) | 485 ui.status(_(b'downgrading from dirstate-v2 to v1\n')) |
486 upgrade_dirstate(ui, srcrepo, upgrade_op, b'v2', b'v1') | 486 upgrade_dirstate(ui, srcrepo, upgrade_op, b'v2', b'v1') |
487 upgrade_op.removed_actions.remove(upgrade_actions.dirstatev2) | 487 upgrade_op.removed_actions.remove(upgrade_actions.dirstatev2) |
488 | 488 |
489 if upgrade_actions.dirstatetrackedkey in upgrade_op.upgrade_actions: | |
490 ui.status(_(b'create dirstate-tracked-key file\n')) | |
491 upgrade_tracked_key(ui, srcrepo, upgrade_op, add=True) | |
492 upgrade_op.upgrade_actions.remove(upgrade_actions.dirstatetrackedkey) | |
493 elif upgrade_actions.dirstatetrackedkey in upgrade_op.removed_actions: | |
494 ui.status(_(b'remove dirstate-tracked-key file\n')) | |
495 upgrade_tracked_key(ui, srcrepo, upgrade_op, add=False) | |
496 upgrade_op.removed_actions.remove(upgrade_actions.dirstatetrackedkey) | |
497 | |
489 if not (upgrade_op.upgrade_actions or upgrade_op.removed_actions): | 498 if not (upgrade_op.upgrade_actions or upgrade_op.removed_actions): |
490 return | 499 return |
491 | 500 |
492 if upgrade_op.requirements_only: | 501 if upgrade_op.requirements_only: |
493 ui.status(_(b'upgrading repository requirements\n')) | 502 ui.status(_(b'upgrading repository requirements\n')) |
658 raise | 667 raise |
659 | 668 |
660 srcrepo.dirstate.write(None) | 669 srcrepo.dirstate.write(None) |
661 | 670 |
662 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements) | 671 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements) |
672 | |
673 | |
674 def upgrade_tracked_key(ui, srcrepo, upgrade_op, add): | |
675 if add: | |
676 srcrepo.dirstate._use_tracked_key = True | |
677 srcrepo.dirstate._dirty = True | |
678 srcrepo.dirstate._dirty_tracked_set = True | |
679 srcrepo.dirstate.write(None) | |
680 if not add: | |
681 srcrepo.dirstate.delete_tracked_key() | |
682 | |
683 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements) |