mercurial/phases.py
changeset 33043 e8c8d81eb864
parent 32841 e65ff29dbeb0
child 33409 50243c975fc2
equal deleted inserted replaced
33042:3e102a8dd52c 33043:e8c8d81eb864
   428             # raced, but got correct result
   428             # raced, but got correct result
   429             return True
   429             return True
   430         else:
   430         else:
   431             return False
   431             return False
   432 
   432 
       
   433 def subsetphaseheads(repo, subset):
       
   434     """Finds the phase heads for a subset of a history
       
   435 
       
   436     Returns a list indexed by phase number where each item is a list of phase
       
   437     head nodes.
       
   438     """
       
   439     cl = repo.changelog
       
   440 
       
   441     headsbyphase = [[] for i in allphases]
       
   442     # No need to keep track of secret phase; any heads in the subset that
       
   443     # are not mentioned are implicitly secret.
       
   444     for phase in allphases[:-1]:
       
   445         revset = "heads(%%ln & %s())" % phasenames[phase]
       
   446         headsbyphase[phase] = [cl.node(r) for r in repo.revs(revset, subset)]
       
   447     return headsbyphase
       
   448 
       
   449 def updatephases(repo, tr, headsbyphase, addednodes):
       
   450     """Updates the repo with the given phase heads"""
       
   451     # First make all the added revisions secret because changegroup.apply()
       
   452     # currently sets the phase to draft.
       
   453     retractboundary(repo, tr, secret, addednodes)
       
   454 
       
   455     # Now advance phase boundaries of all but secret phase
       
   456     for phase in allphases[:-1]:
       
   457         advanceboundary(repo, tr, phase, headsbyphase[phase])
       
   458 
   433 def analyzeremotephases(repo, subset, roots):
   459 def analyzeremotephases(repo, subset, roots):
   434     """Compute phases heads and root in a subset of node from root dict
   460     """Compute phases heads and root in a subset of node from root dict
   435 
   461 
   436     * subset is heads of the subset
   462     * subset is heads of the subset
   437     * roots is {<nodeid> => phase} mapping. key and value are string.
   463     * roots is {<nodeid> => phase} mapping. key and value are string.