changeset 40970:f960c51eebf3

delta: filter nullrev out first When picking a potential candidate, we filter them on various criteria. The "different from nullrev" criteria is very fast to compute and we should process it first.
author Boris Feld <boris.feld@octobus.net>
date Thu, 06 Dec 2018 10:39:05 +0100
parents 74ee5ff1e81c
children abd7b75e80bc
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Thu Dec 06 10:38:30 2018 +0100
+++ b/mercurial/revlogutils/deltas.py	Thu Dec 06 10:39:05 2018 +0100
@@ -633,6 +633,10 @@
                             or deltalength(rev))):
                 tested.add(rev)
                 rev = deltaparent(rev)
+            # no need to try a delta against nullrev, this will be done as a
+            # last resort.
+            if rev == nullrev:
+                continue
             # filter out revision we tested already
             if rev in tested:
                 continue
@@ -640,10 +644,6 @@
             # filter out delta base that will never produce good delta
             if deltas_limit < revlog.length(rev):
                 continue
-            # no need to try a delta against nullrev, this will be done as a
-            # last resort.
-            if rev == nullrev:
-                continue
             # no delta for rawtext-changing revs (see "candelta" for why)
             if revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS:
                 continue