--- a/mercurial/upgrade.py Mon Nov 30 23:54:25 2020 +0100
+++ b/mercurial/upgrade.py Tue Dec 01 02:07:15 2020 +0100
@@ -541,96 +541,102 @@
b'redeltafulladd': b're-delta-fulladd',
}
+ALL_OPTIMISATIONS = []
+
+
+def register_optimization(obj):
+ ALL_OPTIMISATIONS.append(obj)
+ return obj
+
+
+register_optimization(
+ improvement(
+ name=b're-delta-parent',
+ type=OPTIMISATION,
+ description=_(
+ b'deltas within internal storage will be recalculated to '
+ b'choose an optimal base revision where this was not '
+ b'already done; the size of the repository may shrink and '
+ b'various operations may become faster; the first time '
+ b'this optimization is performed could slow down upgrade '
+ b'execution considerably; subsequent invocations should '
+ b'not run noticeably slower'
+ ),
+ upgrademessage=_(
+ b'deltas within internal storage will choose a new '
+ b'base revision if needed'
+ ),
+ )
+)
+
+register_optimization(
+ improvement(
+ name=b're-delta-multibase',
+ type=OPTIMISATION,
+ description=_(
+ b'deltas within internal storage will be recalculated '
+ b'against multiple base revision and the smallest '
+ b'difference will be used; the size of the repository may '
+ b'shrink significantly when there are many merges; this '
+ b'optimization will slow down execution in proportion to '
+ b'the number of merges in the repository and the amount '
+ b'of files in the repository; this slow down should not '
+ b'be significant unless there are tens of thousands of '
+ b'files and thousands of merges'
+ ),
+ upgrademessage=_(
+ b'deltas within internal storage will choose an '
+ b'optimal delta by computing deltas against multiple '
+ b'parents; may slow down execution time '
+ b'significantly'
+ ),
+ )
+)
+
+register_optimization(
+ improvement(
+ name=b're-delta-all',
+ type=OPTIMISATION,
+ description=_(
+ b'deltas within internal storage will always be '
+ b'recalculated without reusing prior deltas; this will '
+ b'likely make execution run several times slower; this '
+ b'optimization is typically not needed'
+ ),
+ upgrademessage=_(
+ b'deltas within internal storage will be fully '
+ b'recomputed; this will likely drastically slow down '
+ b'execution time'
+ ),
+ )
+)
+
+register_optimization(
+ improvement(
+ name=b're-delta-fulladd',
+ type=OPTIMISATION,
+ description=_(
+ b'every revision will be re-added as if it was new '
+ b'content. It will go through the full storage '
+ b'mechanism giving extensions a chance to process it '
+ b'(eg. lfs). This is similar to "re-delta-all" but even '
+ b'slower since more logic is involved.'
+ ),
+ upgrademessage=_(
+ b'each revision will be added as new content to the '
+ b'internal storage; this will likely drastically slow '
+ b'down execution time, but some extensions might need '
+ b'it'
+ ),
+ )
+)
+
def findoptimizations(repo):
"""Determine optimisation that could be used during upgrade"""
# These are unconditionally added. There is logic later that figures out
# which ones to apply.
- optimizations = []
-
- optimizations.append(
- improvement(
- name=b're-delta-parent',
- type=OPTIMISATION,
- description=_(
- b'deltas within internal storage will be recalculated to '
- b'choose an optimal base revision where this was not '
- b'already done; the size of the repository may shrink and '
- b'various operations may become faster; the first time '
- b'this optimization is performed could slow down upgrade '
- b'execution considerably; subsequent invocations should '
- b'not run noticeably slower'
- ),
- upgrademessage=_(
- b'deltas within internal storage will choose a new '
- b'base revision if needed'
- ),
- )
- )
-
- optimizations.append(
- improvement(
- name=b're-delta-multibase',
- type=OPTIMISATION,
- description=_(
- b'deltas within internal storage will be recalculated '
- b'against multiple base revision and the smallest '
- b'difference will be used; the size of the repository may '
- b'shrink significantly when there are many merges; this '
- b'optimization will slow down execution in proportion to '
- b'the number of merges in the repository and the amount '
- b'of files in the repository; this slow down should not '
- b'be significant unless there are tens of thousands of '
- b'files and thousands of merges'
- ),
- upgrademessage=_(
- b'deltas within internal storage will choose an '
- b'optimal delta by computing deltas against multiple '
- b'parents; may slow down execution time '
- b'significantly'
- ),
- )
- )
-
- optimizations.append(
- improvement(
- name=b're-delta-all',
- type=OPTIMISATION,
- description=_(
- b'deltas within internal storage will always be '
- b'recalculated without reusing prior deltas; this will '
- b'likely make execution run several times slower; this '
- b'optimization is typically not needed'
- ),
- upgrademessage=_(
- b'deltas within internal storage will be fully '
- b'recomputed; this will likely drastically slow down '
- b'execution time'
- ),
- )
- )
-
- optimizations.append(
- improvement(
- name=b're-delta-fulladd',
- type=OPTIMISATION,
- description=_(
- b'every revision will be re-added as if it was new '
- b'content. It will go through the full storage '
- b'mechanism giving extensions a chance to process it '
- b'(eg. lfs). This is similar to "re-delta-all" but even '
- b'slower since more logic is involved.'
- ),
- upgrademessage=_(
- b'each revision will be added as new content to the '
- b'internal storage; this will likely drastically slow '
- b'down execution time, but some extensions might need '
- b'it'
- ),
- )
- )
-
- return optimizations
+ return list(ALL_OPTIMISATIONS)
def determineactions(repo, deficiencies, sourcereqs, destreqs):