repoview: protect `base` computation from weird phase root
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 17 Jan 2013 17:51:30 +0100
changeset 18443 64848f7fb764
parent 18442 ecba9b0e7672
child 18444 55aff0c2b73c
repoview: protect `base` computation from weird phase root If for some reason the phase roots contains nullid, the set of filtered revs will contains -1. That confuse Mercurial a lot. In particular this corrupt the branchcache. Standard code path does not result in nullid phase root. It can only result from altered `.hg/store/phaseroots` or buggy extension. However better safe than sorry.
mercurial/repoview.py
--- a/mercurial/repoview.py	Fri Jan 18 15:55:16 2013 -0800
+++ b/mercurial/repoview.py	Thu Jan 17 17:51:30 2013 +0100
@@ -90,6 +90,8 @@
     for roots in repo._phasecache.phaseroots[1:]:
         if roots:
             firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
+    # protect from nullrev root
+    firstmutable = max(0, firstmutable)
     return frozenset(xrange(firstmutable, len(cl)))
 
 # function to compute filtered set