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.
indygreg | |
Alphare |
hg-reviewers |
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.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/revlog.py (6 lines) | |||
M | mercurial/setdiscovery.py (10 lines) |
# first, make sure start revisions aren't filtered | # first, make sure start revisions aren't filtered | ||||
revs = list(revs) | revs = list(revs) | ||||
checkrev = self.node | checkrev = self.node | ||||
for r in revs: | for r in revs: | ||||
checkrev(r) | checkrev(r) | ||||
# and we're sure ancestors aren't filtered as well | # 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 | lazyancestors = rustancestor.LazyAncestors | ||||
arg = self.index | arg = self.index | ||||
else: | else: | ||||
lazyancestors = ancestor.lazyancestors | lazyancestors = ancestor.lazyancestors | ||||
arg = self._uncheckedparentrevs | arg = self._uncheckedparentrevs | ||||
return lazyancestors(arg, revs, stoprev=stoprev, inclusive=inclusive) | return lazyancestors(arg, revs, stoprev=stoprev, inclusive=inclusive) | ||||
def descendants(self, revs): | def descendants(self, revs): | ||||
object. | object. | ||||
'common' is a list of revision numbers. If common is not supplied, uses | 'common' is a list of revision numbers. If common is not supplied, uses | ||||
nullrev. | nullrev. | ||||
""" | """ | ||||
if common is None: | if common is None: | ||||
common = [nullrev] | 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 rustancestor.MissingAncestors(self.index, common) | ||||
return ancestor.incrementalmissingancestors(self.parentrevs, common) | return ancestor.incrementalmissingancestors(self.parentrevs, common) | ||||
def findmissingrevs(self, common=None, heads=None): | def findmissingrevs(self, common=None, heads=None): | ||||
"""Return the revision numbers of the ancestors of heads that | """Return the revision numbers of the ancestors of heads that | ||||
are not ancestors of common. | are not ancestors of common. | ||||
More specifically, return a list of revision numbers corresponding to | More specifically, return a list of revision numbers corresponding to | ||||
return (orderedout, roots, heads) | return (orderedout, roots, heads) | ||||
def headrevs(self, revs=None): | def headrevs(self, revs=None): | ||||
if revs is None: | if revs is None: | ||||
try: | try: | ||||
return self.index.headrevs() | return self.index.headrevs() | ||||
except AttributeError: | except AttributeError: | ||||
return self._headrevs() | 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 rustdagop.headrevs(self.index, revs) | ||||
return dagop.headrevs(revs, self._uncheckedparentrevs) | return dagop.headrevs(revs, self._uncheckedparentrevs) | ||||
def computephases(self, roots): | def computephases(self, roots): | ||||
return self.index.computephasesmapsets(roots) | return self.index.computephasesmapsets(roots) | ||||
def _headrevs(self): | def _headrevs(self): | ||||
count = len(self) | count = len(self) |
if self.randomize: | if self.randomize: | ||||
sample.update(random.sample(takefrom, more)) | sample.update(random.sample(takefrom, more)) | ||||
else: | else: | ||||
takefrom.sort() | takefrom.sort() | ||||
sample.update(takefrom[:more]) | sample.update(takefrom[:more]) | ||||
return sample | return sample | ||||
pure_partialdiscovery = partialdiscovery | |||||
partialdiscovery = policy.importrust( | partialdiscovery = policy.importrust( | ||||
'discovery', member='PartialDiscovery', default=partialdiscovery | 'discovery', member='PartialDiscovery', default=partialdiscovery | ||||
) | ) | ||||
def findcommonheads( | def findcommonheads( | ||||
ui, | ui, | ||||
local, | local, | ||||
configbool = local.ui.configbool | configbool = local.ui.configbool | ||||
grow_sample = configbool(b'devel', b'discovery.grow-sample') | grow_sample = configbool(b'devel', b'discovery.grow-sample') | ||||
grow_sample = grow_sample and not remote.limitedarguments | grow_sample = grow_sample and not remote.limitedarguments | ||||
dynamic_sample = configbool(b'devel', b'discovery.grow-sample.dynamic') | dynamic_sample = configbool(b'devel', b'discovery.grow-sample.dynamic') | ||||
hard_limit_sample = not (dynamic_sample or remote.limitedarguments) | hard_limit_sample = not (dynamic_sample or remote.limitedarguments) | ||||
randomize = ui.configbool(b'devel', b'discovery.randomize') | randomize = ui.configbool(b'devel', b'discovery.randomize') | ||||
disco = partialdiscovery( | if cl.index.rust_ext_compat: | ||||
local, ownheads, hard_limit_sample, randomize=randomize | pd = partialdiscovery | ||||
) | else: | ||||
pd = pure_partialdiscovery | |||||
disco = pd(local, ownheads, hard_limit_sample, randomize=randomize) | |||||
if initial_head_exchange: | if initial_head_exchange: | ||||
# treat remote heads (and maybe own heads) as a first implicit sample | # treat remote heads (and maybe own heads) as a first implicit sample | ||||
# response | # response | ||||
disco.addcommons(knownsrvheads) | disco.addcommons(knownsrvheads) | ||||
disco.addinfo(zip(sample, yesno)) | disco.addinfo(zip(sample, yesno)) | ||||
full = not initial_head_exchange | full = not initial_head_exchange | ||||
progress = ui.makeprogress(_(b'searching'), unit=_(b'queries')) | progress = ui.makeprogress(_(b'searching'), unit=_(b'queries')) |