Mercurial > hg
comparison mercurial/upgrade.py @ 31898:9db45228da52
upgrade: directly iterate over optimisations
Since we already have the list of optimisations independent from the
deficiencies, we can use it directly.
(we make a dual assignement in this changeset to simplify the next one)
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 07 Apr 2017 18:46:27 +0200 |
parents | d0067250542d |
children | cccd8e1538b0 |
comparison
equal
deleted
inserted
replaced
31897:d0067250542d | 31898:9db45228da52 |
---|---|
619 raise error.Abort(_('cannot upgrade repository; do not support ' | 619 raise error.Abort(_('cannot upgrade repository; do not support ' |
620 'destination requirement: %s') % | 620 'destination requirement: %s') % |
621 _(', ').join(sorted(unsupportedreqs))) | 621 _(', ').join(sorted(unsupportedreqs))) |
622 | 622 |
623 # Find and validate all improvements that can be made. | 623 # Find and validate all improvements that can be made. |
624 optimizations = findoptimizations(repo) | 624 alloptimizations = optimizations = findoptimizations(repo) |
625 | 625 |
626 # Validate arguments. | 626 # Validate arguments. |
627 unknownoptimize = optimize - set(i.name for i in optimizations) | 627 unknownoptimize = optimize - set(i.name for i in optimizations) |
628 if unknownoptimize: | 628 if unknownoptimize: |
629 raise error.Abort(_('unknown optimization action requested: %s') % | 629 raise error.Abort(_('unknown optimization action requested: %s') % |
699 'changes:\n\n')) | 699 'changes:\n\n')) |
700 | 700 |
701 printrequirements() | 701 printrequirements() |
702 printupgradeactions() | 702 printupgradeactions() |
703 | 703 |
704 unusedoptimize = [i for i in improvements | 704 unusedoptimize = [i for i in alloptimizations |
705 if i.name not in actions and i.type == optimisation] | 705 if i.name not in actions] |
706 if unusedoptimize: | 706 if unusedoptimize: |
707 ui.write(_('additional optimizations are available by specifying ' | 707 ui.write(_('additional optimizations are available by specifying ' |
708 '"--optimize <name>":\n\n')) | 708 '"--optimize <name>":\n\n')) |
709 for i in unusedoptimize: | 709 for i in unusedoptimize: |
710 ui.write(_('%s\n %s\n\n') % (i.name, i.description)) | 710 ui.write(_('%s\n %s\n\n') % (i.name, i.description)) |