Mercurial > evolve
changeset 3310:87cb2635352b
depthcache: use parents filter in depth cache
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 18 Dec 2017 06:50:57 +0100 |
parents | 09db38b34cb9 |
children | df399e00c10b |
files | hgext3rd/evolve/depthcache.py |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/depthcache.py Mon Dec 18 06:48:49 2017 +0100 +++ b/hgext3rd/evolve/depthcache.py Mon Dec 18 06:50:57 2017 +0100 @@ -5,7 +5,6 @@ from mercurial import ( localrepo, - node as nodemod, util, scmutil, ) @@ -14,10 +13,13 @@ error, exthelper, genericcaches, + utility, ) from mercurial.i18n import _ +filterparents = utility.filterparents + eh = exthelper.exthelper() def simpledepth(repo, rev): @@ -145,14 +147,15 @@ def _depth(self, changelog, rev): cl = changelog - p1, p2 = cl.parentrevs(rev) - if p1 == nodemod.nullrev: + ps = filterparents(cl.parentrevs(rev)) + if not ps: # root case return 1 - elif p2 == nodemod.nullrev: + elif len(ps) == 1: # linear commit case - return self.get(p1) + 1 + return self.get(ps[0]) + 1 # merge case, must find the amount of exclusive content + p1, p2 = ps depth_p1 = self.get(p1) depth_p2 = self.get(p2) # computing depth of a merge