Mercurial > evolve
changeset 2128:318aba30dec3
subranges: migrate handling of single element range
This is the simplest case by far, so we start with that one. We still use the
rich object as an argument, but we'll do our best to not relying on that. This
is important for performance reason.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 22 Mar 2017 03:49:40 +0100 |
parents | e2770faac2df |
children | d07bb7cbae2f |
files | hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/stablerange.py |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Wed Mar 22 03:47:28 2017 +0100 +++ b/hgext3rd/evolve/obsdiscovery.py Wed Mar 22 03:49:40 2017 +0100 @@ -604,8 +604,6 @@ cached = self._repo.stablerange.subranges(self._repo, self) if cached is not None: return cached - if len(self) == 1: - return [] step = _hlp2(self.depth) standard_start = 0 while standard_start < self.index and 0 < step:
--- a/hgext3rd/evolve/stablerange.py Wed Mar 22 03:47:28 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Wed Mar 22 03:49:40 2017 +0100 @@ -103,10 +103,19 @@ revdepth += len(cl.findmissingrevs(common=[anc], heads=[rev])) return revdepth + def rangelength(self, repo, rangeid): + headrev, index = rangeid.head, rangeid.index + return self.depthrev(repo, headrev) - index + def subranges(self, repo, rangeid): cached = self._subrangescache.get(rangeid) if cached is not None: return cached + if self.rangelength(repo, rangeid) == 1: + value = [] + self._subrangescache[rangeid] = value + return value + return None def setsubranges(self, rangeid, value): # XXX temporary cache setter as value computation are performed outside