##// 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 self.filterunknown(repo)
323 self.filterunknown(repo)
324 self.opener = repo.svfs
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 def getrevset(self, repo, phases, subset=None):
348 def getrevset(self, repo, phases, subset=None):
327 """return a smartset for the given phases"""
349 """return a smartset for the given phases"""
328 self.loadphaserevs(repo) # ensure phase's sets are loaded
350 self.loadphaserevs(repo) # ensure phase's sets are loaded
@@ -129,7 +129,7 b' def computeunserved(repo, visibilityexce'
129 def computemutable(repo, visibilityexceptions=None):
129 def computemutable(repo, visibilityexceptions=None):
130 assert not repo.changelog.filteredrevs
130 assert not repo.changelog.filteredrevs
131 # fast check to avoid revset call on huge repo
131 # fast check to avoid revset call on huge repo
132 if any(repo._phasecache.phaseroots[1:]):
132 if repo._phasecache.hasnonpublicphases(repo):
133 getphase = repo._phasecache.phase
133 getphase = repo._phasecache.phase
134 maymutable = filterrevs(repo, b'base')
134 maymutable = filterrevs(repo, b'base')
135 return frozenset(r for r in maymutable if getphase(repo, r))
135 return frozenset(r for r in maymutable if getphase(repo, r))
@@ -154,7 +154,7 b' def computeimpactable(repo, visibilityex'
154 assert not repo.changelog.filteredrevs
154 assert not repo.changelog.filteredrevs
155 cl = repo.changelog
155 cl = repo.changelog
156 firstmutable = len(cl)
156 firstmutable = len(cl)
157 for roots in repo._phasecache.phaseroots[1:]:
157 roots = repo._phasecache.nonpublicphaseroots(repo)
158 if roots:
158 if roots:
159 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
159 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
160 # protect from nullrev root
160 # protect from nullrev root
General Comments 0
You need to be logged in to leave comments. Login now