Mercurial > hg-stable
changeset 31897:d0067250542d
upgrade: simplify optimisations validation
Since we fetch optimizations distinctly from the deficiencies, we can simplify
some code.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 10 Apr 2017 21:01:06 +0200 |
parents | 127b41e975fd |
children | 9db45228da52 |
files | mercurial/upgrade.py |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/upgrade.py Mon Apr 10 21:00:52 2017 +0200 +++ b/mercurial/upgrade.py Mon Apr 10 21:01:06 2017 +0200 @@ -621,21 +621,18 @@ _(', ').join(sorted(unsupportedreqs))) # Find and validate all improvements that can be made. - improvements = finddeficiencies(repo) + findoptimizations(repo) - for i in improvements: - if i.type not in (deficiency, optimisation): - raise error.Abort(_('unexpected improvement type %s for %s') % ( - i.type, i.name)) + optimizations = findoptimizations(repo) # Validate arguments. - unknownoptimize = optimize - set(i.name for i in improvements - if i.type == optimisation) + unknownoptimize = optimize - set(i.name for i in optimizations) if unknownoptimize: raise error.Abort(_('unknown optimization action requested: %s') % ', '.join(sorted(unknownoptimize)), hint=_('run without arguments to see valid ' 'optimizations')) + deficiencies = finddeficiencies(repo) + improvements = deficiencies + optimizations actions = determineactions(repo, improvements, repo.requirements, newreqs, optimize)