revlogdeltas: move special cases around raw revisions in finddeltainfo
authorBoris Feld <boris.feld@octobus.net>
Thu, 16 Aug 2018 04:20:34 +0200
changeset 39332 6f4b8f607a31
parent 39331 fd0150a3c2fe
child 39333 5d343a24bff5
revlogdeltas: move special cases around raw revisions in finddeltainfo The method already contains logic for no-diff cases. Having everything in the same place is more consistent and unlocks other code improvements.
mercurial/revlog.py
mercurial/revlogutils/deltas.py
--- a/mercurial/revlog.py	Wed Aug 29 09:41:04 2018 -0700
+++ b/mercurial/revlog.py	Thu Aug 16 04:20:34 2018 +0200
@@ -1965,13 +1965,7 @@
 
         revinfo = _revisioninfo(node, p1, p2, btext, textlen, cachedelta, flags)
 
-        # no delta for flag processor revision (see "candelta" for why)
-        # not calling candelta since only one revision needs test, also to
-        # avoid overhead fetching flags again.
-        if flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
-            deltainfo = None
-        else:
-            deltainfo = deltacomputer.finddeltainfo(revinfo, fh)
+        deltainfo = deltacomputer.finddeltainfo(revinfo, fh)
 
         if deltainfo is not None:
             base = deltainfo.base
--- a/mercurial/revlogutils/deltas.py	Wed Aug 29 09:41:04 2018 -0700
+++ b/mercurial/revlogutils/deltas.py	Thu Aug 16 04:20:34 2018 +0200
@@ -703,6 +703,12 @@
         if not revinfo.textlen:
             return None # empty file do not need delta
 
+        # no delta for flag processor revision (see "candelta" for why)
+        # not calling candelta since only one revision needs test, also to
+        # avoid overhead fetching flags again.
+        if revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
+            return None
+
         cachedelta = revinfo.cachedelta
         p1 = revinfo.p1
         p2 = revinfo.p2