327 else: |
327 else: |
328 return 0 |
328 return 0 |
329 finally: |
329 finally: |
330 lock.release() |
330 lock.release() |
331 |
331 |
332 def visibleheads(repo): |
|
333 """return the set of visible head of this repo""" |
|
334 # XXX we want a cache on this |
|
335 sroots = repo._phasecache.phaseroots[secret] |
|
336 if sroots: |
|
337 # XXX very slow revset. storing heads or secret "boundary" would help. |
|
338 revset = repo.set('heads(not (%ln::))', sroots) |
|
339 |
|
340 vheads = [ctx.node() for ctx in revset] |
|
341 if not vheads: |
|
342 vheads.append(nullid) |
|
343 else: |
|
344 vheads = repo.heads() |
|
345 return vheads |
|
346 |
|
347 def visiblebranchmap(repo): |
|
348 """return a branchmap for the visible set""" |
|
349 # XXX Recomputing this data on the fly is very slow. We should build a |
|
350 # XXX cached version while computin the standard branchmap version. |
|
351 sroots = repo._phasecache.phaseroots[secret] |
|
352 if sroots: |
|
353 vbranchmap = {} |
|
354 for branch, nodes in repo.branchmap().iteritems(): |
|
355 # search for secret heads. |
|
356 for n in nodes: |
|
357 if repo[n].phase() >= secret: |
|
358 nodes = None |
|
359 break |
|
360 # if secreat heads where found we must compute them again |
|
361 if nodes is None: |
|
362 s = repo.set('heads(branch(%s) - secret())', branch) |
|
363 nodes = [c.node() for c in s] |
|
364 vbranchmap[branch] = nodes |
|
365 else: |
|
366 vbranchmap = repo.branchmap() |
|
367 return vbranchmap |
|
368 |
|
369 def analyzeremotephases(repo, subset, roots): |
332 def analyzeremotephases(repo, subset, roots): |
370 """Compute phases heads and root in a subset of node from root dict |
333 """Compute phases heads and root in a subset of node from root dict |
371 |
334 |
372 * subset is heads of the subset |
335 * subset is heads of the subset |
373 * roots is {<nodeid> => phase} mapping. key and value are string. |
336 * roots is {<nodeid> => phase} mapping. key and value are string. |