[PATCH 2 of 2] reachableroots: use baseset lazy sorting
Yuya Nishihara
yuya at tcha.org
Sat Aug 22 06:33:44 CDT 2015
On Fri, 21 Aug 2015 15:58:42 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1440116601 25200
> # Thu Aug 20 17:23:21 2015 -0700
> # Node ID 1635f6a58066e632e3818cf9e9bf0c5aacb3e9f4
> # Parent 76e8706080029160e4b71b043ac20b2760516eab
> reachableroots: use baseset lazy sorting
>
> smartset sorting is lazy (so faster in some case) and better (informs that the
> set is sorted allowing some optimisation). So we rely on it directly.
>
> Some test output are updated because we now have more information (ordering).
>
> diff --git a/mercurial/changelog.py b/mercurial/changelog.py
> --- a/mercurial/changelog.py
> +++ b/mercurial/changelog.py
> @@ -184,12 +184,14 @@ class changelog(revlog.revlog):
> # XXX need filtering too
> self.rev(self.node(0))
> return self._nodecache
>
> def reachableroots(self, minroot, heads, roots, includepath=False):
> - return revset.baseset(sorted(
> - self.index.reachableroots(minroot, heads, roots, includepath)))
> + rroots = self.index.reachableroots(minroot, heads, roots, includepath)
> + rroots = revset.baseset(rroots)
> + rroots.sort()
> + return rroots
The series looks good to me.
This will save ~10% time of "0::tip" because baseset can sort list in place.
More information about the Mercurial-devel
mailing list