##// END OF EJS Templates
branchmap-v3: introduce a "stop_rev" argument to `headsrevs`...
marmoute -
r52870:42a116f1 default
parent child Browse files
Show More
@@ -884,8 +884,7 class BranchCacheV3(_LocalBranchCache):
884 884 elif self.tiprev == cl.tiprev():
885 885 return cl.headrevs()
886 886 else:
887 # XXX passing tiprev as ceiling of cl.headrevs could be faster
888 heads = cl.headrevs(cl.revs(stop=self.tiprev))
887 heads = cl.headrevs(stop_rev=self.tiprev + 1)
889 888 return heads
890 889
891 890 def _write_header(self, fp) -> None:
@@ -310,9 +310,14 class filteredchangelogmixin:
310 310 # no Rust fast path implemented yet, so just loop in Python
311 311 return [self.node(r) for r in self.headrevs()]
312 312
313 def headrevs(self, revs=None):
313 def headrevs(self, revs=None, stop_rev=None):
314 314 if revs is None:
315 return self.index.headrevs(self.filteredrevs)
315 filtered = self.filteredrevs
316 if stop_rev is not None and stop_rev < len(self.index):
317 filtered = set(self.filteredrevs)
318 filtered.update(range(stop_rev, len(self.index)))
319 return self.index.headrevs(filtered)
320 assert stop_rev is None
316 321
317 322 revs = self._checknofilteredinrevs(revs)
318 323 return super(filteredchangelogmixin, self).headrevs(revs)
@@ -2380,9 +2380,15 class revlog:
2380 2380 assert heads
2381 2381 return (orderedout, roots, heads)
2382 2382
2383 def headrevs(self, revs=None):
2383 def headrevs(self, revs=None, stop_rev=None):
2384 2384 if revs is None:
2385 return self.index.headrevs()
2385 excluded = None
2386 if stop_rev is not None and stop_rev < len(self.index):
2387 # We should let the native code handle it, but that a
2388 # simple enough first step.
2389 excluded = range(stop_rev, len(self.index))
2390 return self.index.headrevs(excluded)
2391 assert stop_rev is None
2386 2392 if rustdagop is not None and self.index.rust_ext_compat:
2387 2393 return rustdagop.headrevs(self.index, revs)
2388 2394 return dagop.headrevs(revs, self._uncheckedparentrevs)
General Comments 0
You need to be logged in to leave comments. Login now