Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade_utils/actions.py @ 46205:53d083fa1f83
upgrade: rename finddeficiences() to find_format_upgrades()
It was not obvious what does deficieny means and every format upgrade can't be a
deficiency. There are some format upgrades like compression levels, share-safe
which can't be understood at deficiencies.
A change can be an upgrade or downgrade, however this `finddeficiences()` only
used to find upgrades.
This patch renames the function and related variables to make things more
clearer. The ui message also got improved which is a good thing.
Next patch will rename deficiency in general across the upgrade code.
Differential Revision: https://phab.mercurial-scm.org/D9582
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 14 Dec 2020 16:03:15 +0530 |
parents | 25d11b24dedf |
children | 9540945e51fd |
comparison
equal
deleted
inserted
replaced
46204:36c05ab02232 | 46205:53d083fa1f83 |
---|---|
408 if level is None: | 408 if level is None: |
409 return b'default' | 409 return b'default' |
410 return bytes(level) | 410 return bytes(level) |
411 | 411 |
412 | 412 |
413 def finddeficiencies(repo): | 413 def find_format_upgrades(repo): |
414 """returns a list of deficiencies that the repo suffer from""" | 414 """returns a list of format upgrades which can be perform on the repo""" |
415 deficiencies = [] | 415 upgrades = [] |
416 | 416 |
417 # We could detect lack of revlogv1 and store here, but they were added | 417 # We could detect lack of revlogv1 and store here, but they were added |
418 # in 0.9.2 and we don't support upgrading repos without these | 418 # in 0.9.2 and we don't support upgrading repos without these |
419 # requirements, so let's not bother. | 419 # requirements, so let's not bother. |
420 | 420 |
421 for fv in allformatvariant: | 421 for fv in allformatvariant: |
422 if not fv.fromrepo(repo): | 422 if not fv.fromrepo(repo): |
423 deficiencies.append(fv) | 423 upgrades.append(fv) |
424 | 424 |
425 return deficiencies | 425 return upgrades |
426 | 426 |
427 | 427 |
428 ALL_OPTIMISATIONS = [] | 428 ALL_OPTIMISATIONS = [] |
429 | 429 |
430 | 430 |
521 # These are unconditionally added. There is logic later that figures out | 521 # These are unconditionally added. There is logic later that figures out |
522 # which ones to apply. | 522 # which ones to apply. |
523 return list(ALL_OPTIMISATIONS) | 523 return list(ALL_OPTIMISATIONS) |
524 | 524 |
525 | 525 |
526 def determineactions(repo, deficiencies, sourcereqs, destreqs): | 526 def determineactions(repo, format_upgrades, sourcereqs, destreqs): |
527 """Determine upgrade actions that will be performed. | 527 """Determine upgrade actions that will be performed. |
528 | 528 |
529 Given a list of improvements as returned by ``finddeficiencies`` and | 529 Given a list of improvements as returned by ``find_format_upgrades`` and |
530 ``findoptimizations``, determine the list of upgrade actions that | 530 ``findoptimizations``, determine the list of upgrade actions that |
531 will be performed. | 531 will be performed. |
532 | 532 |
533 The role of this function is to filter improvements if needed, apply | 533 The role of this function is to filter improvements if needed, apply |
534 recommended optimizations from the improvements list that make sense, | 534 recommended optimizations from the improvements list that make sense, |
536 | 536 |
537 Returns a list of action names. | 537 Returns a list of action names. |
538 """ | 538 """ |
539 newactions = [] | 539 newactions = [] |
540 | 540 |
541 for d in deficiencies: | 541 for d in format_upgrades: |
542 name = d._requirement | 542 name = d._requirement |
543 | 543 |
544 # If the action is a requirement that doesn't show up in the | 544 # If the action is a requirement that doesn't show up in the |
545 # destination requirements, prune the action. | 545 # destination requirements, prune the action. |
546 if name is not None and name not in destreqs: | 546 if name is not None and name not in destreqs: |