Patchwork D10666: revlog: do not call Rust code if the index is not compatible with it

login
register
mail settings
Submitter phabricator
Date May 4, 2021, 2:20 p.m.
Message ID <differential-rev-PHID-DREV-nu27sm7skvayjamw7h3t-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48984/
State Superseded
Headers show

Comments

phabricator - May 4, 2021, 2:20 p.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will avoid hitting the TypeError we defined in the previous changesets.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10666

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1062,7 +1062,7 @@ 
             checkrev(r)
         # and we're sure ancestors aren't filtered as well
 
-        if rustancestor is not None:
+        if rustancestor is not None and self.index.rust_ext_compat:
             lazyancestors = rustancestor.LazyAncestors
             arg = self.index
         else:
@@ -1149,7 +1149,7 @@ 
         if common is None:
             common = [nullrev]
 
-        if rustancestor is not None:
+        if rustancestor is not None and self.index.rust_ext_compat:
             return rustancestor.MissingAncestors(self.index, common)
         return ancestor.incrementalmissingancestors(self.parentrevs, common)
 
@@ -1369,7 +1369,7 @@ 
                 return self.index.headrevs()
             except AttributeError:
                 return self._headrevs()
-        if rustdagop is not None:
+        if rustdagop is not None and self.index.rust_ext_compat:
             return rustdagop.headrevs(self.index, revs)
         return dagop.headrevs(revs, self._uncheckedparentrevs)