Patchwork [07,of,12] revlogdeltas: move special cases around raw revisions in finddeltainfo

login
register
mail settings
Submitter Boris Feld
Date Aug. 18, 2018, 9:27 a.m.
Message ID <4176db0d0e40db1a9d11.1534584442@FB-lair>
Download mbox | patch
Permalink /patch/33872/
State Accepted
Headers show

Comments

Boris Feld - Aug. 18, 2018, 9:27 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1534386034 -7200
#      Thu Aug 16 04:20:34 2018 +0200
# Node ID 4176db0d0e40db1a9d1185d5f02469b5a7f5a9e4
# Parent  ff271ee5114d870492da10e625b43b8bf2ee23e4
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4176db0d0e40
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.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1947,13 +1947,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