Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 51394:a0d88b021a98
unbundle: faster computation of changed heads
To compute the set of changed heads it's sufficient to look at the recent commits,
instead of looking at all heads currently in existence.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Thu, 21 Dec 2023 17:38:04 +0000 |
parents | 0106df85efd5 |
children | def497c75351 |
line wrap: on
line diff
--- a/mercurial/revlog.py Wed Feb 21 11:53:30 2024 +0100 +++ b/mercurial/revlog.py Thu Dec 21 17:38:04 2023 +0000 @@ -132,6 +132,7 @@ # max size of inline data embedded into a revlog _maxinline = 131072 + # Flag processors for REVIDX_ELLIPSIS. def ellipsisreadprocessor(rl, text): return text, False @@ -1577,7 +1578,6 @@ ] def _loadindex(self, docket=None): - new_header, mmapindexthreshold, force_nodemap = self._init_opts() if self.postfix is not None: @@ -2345,6 +2345,12 @@ return rustdagop.headrevs(self.index, revs) return dagop.headrevs(revs, self._uncheckedparentrevs) + def headrevsdiff(self, start, stop): + try: + return self.index.headrevsdiff(start, stop) + except AttributeError: + return dagop.headrevsdiff(self._uncheckedparentrevs, start, stop) + def computephases(self, roots): return self.index.computephasesmapsets(roots) @@ -2392,6 +2398,12 @@ return [self.node(rev) for rev in revs] + def diffheads(self, start, stop): + """return the nodes that make up the difference between + heads of revs before `start` and heads of revs before `stop`""" + removed, added = self.headrevsdiff(start, stop) + return [self.node(r) for r in removed], [self.node(r) for r in added] + def children(self, node): """find the children of a given node""" c = []