Mercurial > hg-stable
changeset 26061:be8a4e0800d8
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).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 20 Aug 2015 17:23:21 -0700 |
parents | 4ee2af2194d4 |
children | 7154a4a08b96 |
files | mercurial/changelog.py tests/test-parseindex.t tests/test-revset.t |
diffstat | 3 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Thu Aug 20 17:19:56 2015 -0700 +++ b/mercurial/changelog.py Thu Aug 20 17:23:21 2015 -0700 @@ -186,8 +186,10 @@ return self._nodecache def reachableroots(self, minroot, heads, roots, includepath=False): - return revset.baseset(sorted( - self.index.reachableroots2(minroot, heads, roots, includepath))) + rroots = self.index.reachableroots2(minroot, heads, roots, includepath) + rroots = revset.baseset(rroots) + rroots.sort() + return rroots def headrevs(self): if self.filteredrevs:
--- a/tests/test-parseindex.t Thu Aug 20 17:19:56 2015 -0700 +++ b/tests/test-parseindex.t Thu Aug 20 17:23:21 2015 -0700 @@ -96,9 +96,9 @@ > print inst > EOF good heads: - 0: <baseset [0]> - 1: <baseset [0]> - -1: <baseset []> + 0: <baseset+ [0]> + 1: <baseset+ [0]> + -1: <baseset+ []> bad heads: 2: head out of range 10000: head out of range @@ -106,14 +106,14 @@ -10000: head out of range None: an integer is required good roots: - 0: <baseset [0]> - 1: <baseset [1]> - -1: <baseset [-1]> + 0: <baseset+ [0]> + 1: <baseset+ [1]> + -1: <baseset+ [-1]> out-of-range roots are ignored: - 2: <baseset []> - 10000: <baseset []> - -2: <baseset []> - -10000: <baseset []> + 2: <baseset+ []> + 10000: <baseset+ []> + -2: <baseset+ []> + -10000: <baseset+ []> bad roots: None: an integer is required
--- a/tests/test-revset.t Thu Aug 20 17:19:56 2015 -0700 +++ b/tests/test-revset.t Thu Aug 20 17:23:21 2015 -0700 @@ -141,7 +141,7 @@ ('symbol', '3') ('symbol', '6')) * set: - <baseset [3, 5, 6]> + <baseset+ [3, 5, 6]> 3 5 6 @@ -991,7 +991,7 @@ ('symbol', '4'))) * set: <addset - <baseset [5, 3, 1]>, + <baseset- [1, 3, 5]>, <generatorset+>> 5 3 @@ -1014,7 +1014,7 @@ * set: <addset+ <generatorset+>, - <baseset [5, 3, 1]>> + <baseset- [1, 3, 5]>> 0 1 2