290 # If the action is a requirement that doesn't show up in the |
290 # If the action is a requirement that doesn't show up in the |
291 # destination requirements, prune the action. |
291 # destination requirements, prune the action. |
292 if name in knownreqs and name not in destreqs: |
292 if name in knownreqs and name not in destreqs: |
293 continue |
293 continue |
294 |
294 |
295 newactions.append(name) |
295 newactions.append(d) |
296 |
296 |
297 # FUTURE consider adding some optimizations here for certain transitions. |
297 # FUTURE consider adding some optimizations here for certain transitions. |
298 # e.g. adding generaldelta could schedule parent redeltas. |
298 # e.g. adding generaldelta could schedule parent redeltas. |
299 |
299 |
300 return newactions |
300 return newactions |
637 ', '.join(sorted(optimize)), |
637 ', '.join(sorted(optimize)), |
638 hint=_('run without arguments to see valid ' |
638 hint=_('run without arguments to see valid ' |
639 'optimizations')) |
639 'optimizations')) |
640 |
640 |
641 deficiencies = finddeficiencies(repo) |
641 deficiencies = finddeficiencies(repo) |
642 improvements = deficiencies + optimizations |
|
643 actions = determineactions(repo, deficiencies, repo.requirements, newreqs) |
642 actions = determineactions(repo, deficiencies, repo.requirements, newreqs) |
644 actions.extend(o.name for o in sorted(optimizations) |
643 actions.extend(o for o in sorted(optimizations) |
645 # determineactions could have added optimisation |
644 # determineactions could have added optimisation |
646 if o.name not in actions) |
645 if o not in actions) |
647 |
646 |
648 def printrequirements(): |
647 def printrequirements(): |
649 ui.write(_('requirements\n')) |
648 ui.write(_('requirements\n')) |
650 ui.write(_(' preserved: %s\n') % |
649 ui.write(_(' preserved: %s\n') % |
651 _(', ').join(sorted(newreqs & repo.requirements))) |
650 _(', ').join(sorted(newreqs & repo.requirements))) |
659 _(', ').join(sorted(newreqs - repo.requirements))) |
658 _(', ').join(sorted(newreqs - repo.requirements))) |
660 |
659 |
661 ui.write('\n') |
660 ui.write('\n') |
662 |
661 |
663 def printupgradeactions(): |
662 def printupgradeactions(): |
664 for action in actions: |
663 for a in actions: |
665 for i in improvements: |
664 ui.write('%s\n %s\n\n' % (a.name, a.upgrademessage)) |
666 if i.name == action: |
|
667 ui.write('%s\n %s\n\n' % |
|
668 (i.name, i.upgrademessage)) |
|
669 |
665 |
670 if not run: |
666 if not run: |
671 fromdefault = [] |
667 fromdefault = [] |
672 fromconfig = [] |
668 fromconfig = [] |
673 |
669 |
703 'changes:\n\n')) |
699 'changes:\n\n')) |
704 |
700 |
705 printrequirements() |
701 printrequirements() |
706 printupgradeactions() |
702 printupgradeactions() |
707 |
703 |
708 unusedoptimize = [i for i in alloptimizations |
704 unusedoptimize = [i for i in alloptimizations if i not in actions] |
709 if i.name not in actions] |
705 |
710 if unusedoptimize: |
706 if unusedoptimize: |
711 ui.write(_('additional optimizations are available by specifying ' |
707 ui.write(_('additional optimizations are available by specifying ' |
712 '"--optimize <name>":\n\n')) |
708 '"--optimize <name>":\n\n')) |
713 for i in unusedoptimize: |
709 for i in unusedoptimize: |
714 ui.write(_('%s\n %s\n\n') % (i.name, i.description)) |
710 ui.write(_('%s\n %s\n\n') % (i.name, i.description)) |
716 |
712 |
717 # Else we're in the run=true case. |
713 # Else we're in the run=true case. |
718 ui.write(_('upgrade will perform the following actions:\n\n')) |
714 ui.write(_('upgrade will perform the following actions:\n\n')) |
719 printrequirements() |
715 printrequirements() |
720 printupgradeactions() |
716 printupgradeactions() |
|
717 |
|
718 upgradeactions = [a.name for a in actions] |
721 |
719 |
722 ui.write(_('beginning upgrade...\n')) |
720 ui.write(_('beginning upgrade...\n')) |
723 with repo.wlock(): |
721 with repo.wlock(): |
724 with repo.lock(): |
722 with repo.lock(): |
725 ui.write(_('repository locked and read-only\n')) |
723 ui.write(_('repository locked and read-only\n')) |
738 create=True) |
736 create=True) |
739 |
737 |
740 with dstrepo.wlock(): |
738 with dstrepo.wlock(): |
741 with dstrepo.lock(): |
739 with dstrepo.lock(): |
742 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs, |
740 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs, |
743 actions) |
741 upgradeactions) |
744 |
742 |
745 finally: |
743 finally: |
746 ui.write(_('removing temporary repository %s\n') % tmppath) |
744 ui.write(_('removing temporary repository %s\n') % tmppath) |
747 repo.vfs.rmtree(tmppath, forcibly=True) |
745 repo.vfs.rmtree(tmppath, forcibly=True) |
748 |
746 |