Show More
@@ -884,8 +884,7 class BranchCacheV3(_LocalBranchCache): | |||||
884 | elif self.tiprev == cl.tiprev(): |
|
884 | elif self.tiprev == cl.tiprev(): | |
885 | return cl.headrevs() |
|
885 | return cl.headrevs() | |
886 | else: |
|
886 | else: | |
887 | # XXX passing tiprev as ceiling of cl.headrevs could be faster |
|
887 | heads = cl.headrevs(stop_rev=self.tiprev + 1) | |
888 | heads = cl.headrevs(cl.revs(stop=self.tiprev)) |
|
|||
889 | return heads |
|
888 | return heads | |
890 |
|
889 | |||
891 | def _write_header(self, fp) -> None: |
|
890 | def _write_header(self, fp) -> None: |
@@ -310,9 +310,14 class filteredchangelogmixin: | |||||
310 | # no Rust fast path implemented yet, so just loop in Python |
|
310 | # no Rust fast path implemented yet, so just loop in Python | |
311 | return [self.node(r) for r in self.headrevs()] |
|
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 | if revs is None: |
|
314 | if revs is None: | |
315 |
|
|
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 | revs = self._checknofilteredinrevs(revs) |
|
322 | revs = self._checknofilteredinrevs(revs) | |
318 | return super(filteredchangelogmixin, self).headrevs(revs) |
|
323 | return super(filteredchangelogmixin, self).headrevs(revs) |
@@ -2380,9 +2380,15 class revlog: | |||||
2380 | assert heads |
|
2380 | assert heads | |
2381 | return (orderedout, roots, heads) |
|
2381 | return (orderedout, roots, heads) | |
2382 |
|
2382 | |||
2383 | def headrevs(self, revs=None): |
|
2383 | def headrevs(self, revs=None, stop_rev=None): | |
2384 | if revs is None: |
|
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 | if rustdagop is not None and self.index.rust_ext_compat: |
|
2392 | if rustdagop is not None and self.index.rust_ext_compat: | |
2387 | return rustdagop.headrevs(self.index, revs) |
|
2393 | return rustdagop.headrevs(self.index, revs) | |
2388 | return dagop.headrevs(revs, self._uncheckedparentrevs) |
|
2394 | return dagop.headrevs(revs, self._uncheckedparentrevs) |
General Comments 0
You need to be logged in to leave comments.
Login now