Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 47280:6be2a7ca4b1d
revlog: do not call Rust code if the index is not compatible with it
This will avoid hitting the TypeError we defined in the previous changesets.
This is the simplest fix but not the most elegant.
Ideally we would teach the Rust code to use any kind of revlog. However this is
an adventure for another time.
Differential Revision: https://phab.mercurial-scm.org/D10666
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 04 May 2021 14:18:06 +0200 |
parents | 921648d31553 |
children | 25ce16bf724b |
comparison
equal
deleted
inserted
replaced
47279:9d1a8829f959 | 47280:6be2a7ca4b1d |
---|---|
1061 checkrev = self.node | 1061 checkrev = self.node |
1062 for r in revs: | 1062 for r in revs: |
1063 checkrev(r) | 1063 checkrev(r) |
1064 # and we're sure ancestors aren't filtered as well | 1064 # and we're sure ancestors aren't filtered as well |
1065 | 1065 |
1066 if rustancestor is not None: | 1066 if rustancestor is not None and self.index.rust_ext_compat: |
1067 lazyancestors = rustancestor.LazyAncestors | 1067 lazyancestors = rustancestor.LazyAncestors |
1068 arg = self.index | 1068 arg = self.index |
1069 else: | 1069 else: |
1070 lazyancestors = ancestor.lazyancestors | 1070 lazyancestors = ancestor.lazyancestors |
1071 arg = self._uncheckedparentrevs | 1071 arg = self._uncheckedparentrevs |
1148 nullrev. | 1148 nullrev. |
1149 """ | 1149 """ |
1150 if common is None: | 1150 if common is None: |
1151 common = [nullrev] | 1151 common = [nullrev] |
1152 | 1152 |
1153 if rustancestor is not None: | 1153 if rustancestor is not None and self.index.rust_ext_compat: |
1154 return rustancestor.MissingAncestors(self.index, common) | 1154 return rustancestor.MissingAncestors(self.index, common) |
1155 return ancestor.incrementalmissingancestors(self.parentrevs, common) | 1155 return ancestor.incrementalmissingancestors(self.parentrevs, common) |
1156 | 1156 |
1157 def findmissingrevs(self, common=None, heads=None): | 1157 def findmissingrevs(self, common=None, heads=None): |
1158 """Return the revision numbers of the ancestors of heads that | 1158 """Return the revision numbers of the ancestors of heads that |
1368 if revs is None: | 1368 if revs is None: |
1369 try: | 1369 try: |
1370 return self.index.headrevs() | 1370 return self.index.headrevs() |
1371 except AttributeError: | 1371 except AttributeError: |
1372 return self._headrevs() | 1372 return self._headrevs() |
1373 if rustdagop is not None: | 1373 if rustdagop is not None and self.index.rust_ext_compat: |
1374 return rustdagop.headrevs(self.index, revs) | 1374 return rustdagop.headrevs(self.index, revs) |
1375 return dagop.headrevs(revs, self._uncheckedparentrevs) | 1375 return dagop.headrevs(revs, self._uncheckedparentrevs) |
1376 | 1376 |
1377 def computephases(self, roots): | 1377 def computephases(self, roots): |
1378 return self.index.computephasesmapsets(roots) | 1378 return self.index.computephasesmapsets(roots) |