mercurial/phases.py
changeset 15649 ca7c4254a21a
parent 15648 79cc89de5be1
child 15659 7fba5a245acc
equal deleted inserted replaced
15648:79cc89de5be1 15649:ca7c4254a21a
   138             return 1
   138             return 1
   139         else:
   139         else:
   140             return 0
   140             return 0
   141     finally:
   141     finally:
   142         lock.release()
   142         lock.release()
       
   143 
       
   144 def analyzeremotephases(repo, subset, roots):
       
   145     """Compute phases heads and root in a subset of node from root dict
       
   146 
       
   147     * subset is heads of the subset
       
   148     * roots is {<nodeid> => phase} mapping. key and value are string.
       
   149 
       
   150     Accept unknown element input
       
   151     """
       
   152     # build list from dictionary
       
   153     phaseroots = [[] for p in allphases]
       
   154     for nhex, phase in roots.iteritems():
       
   155         if nhex == 'publishing': # ignore data related to publish option
       
   156             continue
       
   157         node = bin(nhex)
       
   158         phase = int(phase)
       
   159         if node in repo:
       
   160             phaseroots[phase].append(node)
       
   161     # compute heads
       
   162     phaseheads = [[] for p in allphases]
       
   163     for phase in allphases[:-1]:
       
   164         toproof = phaseroots[phase + 1]
       
   165         revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))',
       
   166                           subset, toproof, toproof, subset)
       
   167         phaseheads[phase].extend(c.node() for c in revset)
       
   168     return phaseheads, phaseroots
       
   169