Mercurial > evolve
changeset 2092:ed140544e7fd
stablerange: remove call to 'repo.revs'
It turned out that the percentage of time spend parsing the revset string was
two digits, so we compute de heads inline.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 11 Mar 2017 14:46:27 -0800 |
parents | fcb8db796576 |
children | e7ad31804da8 |
files | hgext3rd/evolve/obsdiscovery.py |
diffstat | 1 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Sun Mar 12 08:38:39 2017 -0700 +++ b/hgext3rd/evolve/obsdiscovery.py Sat Mar 11 14:46:27 2017 -0800 @@ -557,15 +557,28 @@ cl = self._repo.changelog + result = [] bottom = self._revs[:localindex] - top = self._revs[localindex:] - bheads = self._repo.revs('heads(%ld)', bottom) - result = [] + top = _range(self._repo, self.head, globalindex, self._revs[localindex:]) + # + toprootdepth = utility.depth(self._repo, top._revs[0]) + if toprootdepth + len(top) == self.depth + 1: + bheads = [bottom[-1]] + else: + bheads = set(bottom) + parentrevs = cl.parentrevs + du = bheads.difference_update + for r in bottom: + du(parentrevs(r)) + # if len(bheads) == 1: + # assert 1 == len(self._repo.revs('roots(%ld)', top._revs)) if len(bheads) == 1: newhead = bottom[-1] - newstart = utility.depth(self._repo, newhead) - len(bottom) + bottomdepth = utility.depth(self._repo, newhead) + newstart = bottomdepth - len(bottom) result.append(_range(self._repo, newhead, newstart, bottom)) else: + # assert 1 < len(bheads), (toprootdepth, len(top), len(self)) cl = self._repo.changelog for h in bheads: subset = cl.ancestors([h], inclusive=True) @@ -573,7 +586,7 @@ start = utility.depth(self._repo, h) - len(hrevs) entry = _range(self._repo, h, start, [r for r in bottom if r in subset]) result.append(entry) - result.append(_range(self._repo, self.head, globalindex, top)) + result.append(top) return result def subranges(self):