##// END OF EJS Templates
phases: provide a test and accessor for non-public phase roots...
Joerg Sonnenberger -
r45674:e2d17974 default
parent child Browse files
Show More
@@ -323,6 +323,28 b' class phasecache(object):'
323 323 self.filterunknown(repo)
324 324 self.opener = repo.svfs
325 325
326 def hasnonpublicphases(self, repo):
327 """detect if there are revisions with non-public phase"""
328 repo = repo.unfiltered()
329 cl = repo.changelog
330 if len(cl) >= self._loadedrevslen:
331 self.invalidate()
332 self.loadphaserevs(repo)
333 return any(self.phaseroots[1:])
334
335 def nonpublicphaseroots(self, repo):
336 """returns the roots of all non-public phases
337
338 The roots are not minimized, so if the secret revisions are
339 descendants of draft revisions, their roots will still be present.
340 """
341 repo = repo.unfiltered()
342 cl = repo.changelog
343 if len(cl) >= self._loadedrevslen:
344 self.invalidate()
345 self.loadphaserevs(repo)
346 return set().union(*[roots for roots in self.phaseroots[1:] if roots])
347
326 348 def getrevset(self, repo, phases, subset=None):
327 349 """return a smartset for the given phases"""
328 350 self.loadphaserevs(repo) # ensure phase's sets are loaded
@@ -129,7 +129,7 b' def computeunserved(repo, visibilityexce'
129 129 def computemutable(repo, visibilityexceptions=None):
130 130 assert not repo.changelog.filteredrevs
131 131 # fast check to avoid revset call on huge repo
132 if any(repo._phasecache.phaseroots[1:]):
132 if repo._phasecache.hasnonpublicphases(repo):
133 133 getphase = repo._phasecache.phase
134 134 maymutable = filterrevs(repo, b'base')
135 135 return frozenset(r for r in maymutable if getphase(repo, r))
@@ -154,9 +154,9 b' def computeimpactable(repo, visibilityex'
154 154 assert not repo.changelog.filteredrevs
155 155 cl = repo.changelog
156 156 firstmutable = len(cl)
157 for roots in repo._phasecache.phaseroots[1:]:
158 if roots:
159 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
157 roots = repo._phasecache.nonpublicphaseroots(repo)
158 if roots:
159 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
160 160 # protect from nullrev root
161 161 firstmutable = max(0, firstmutable)
162 162 return frozenset(pycompat.xrange(firstmutable, len(cl)))
General Comments 0
You need to be logged in to leave comments. Login now