[PATCH 06 of 11 V2] revlogdeltas: move special cases around raw revisions in finddeltainfo

Boris Feld boris.feld at octobus.net
Mon Aug 27 06:06:33 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1534386034 -7200
#      Thu Aug 16 04:20:34 2018 +0200
# Node ID 050101b1b6db5bb9a6d6e887ec3145f8bff4188b
# Parent  c92f0df36ad5efafde442870039279f068a64c30
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 050101b1b6db
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.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1965,13 +1965,7 @@ class revlog(object):
 
         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
diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -704,6 +704,12 @@ class deltacomputer(object):
         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


More information about the Mercurial-devel mailing list