mercurial/phases.py
changeset 34320 12c42bcd4133
parent 34319 5779d096a696
child 34321 4ef472b975ff
equal deleted inserted replaced
34319:5779d096a696 34320:12c42bcd4133
   166     binarydata = []
   166     binarydata = []
   167     for phase, nodes in enumerate(phasemapping):
   167     for phase, nodes in enumerate(phasemapping):
   168         for head in nodes:
   168         for head in nodes:
   169             binarydata.append(_fphasesentry.pack(phase, head))
   169             binarydata.append(_fphasesentry.pack(phase, head))
   170     return ''.join(binarydata)
   170     return ''.join(binarydata)
       
   171 
       
   172 def binarydecode(stream):
       
   173     """decode a binary stream into a 'phase -> nodes' mapping
       
   174 
       
   175     Since phases are integer the mapping is actually a python list."""
       
   176     headsbyphase = [[] for i in allphases]
       
   177     entrysize = _fphasesentry.size
       
   178     while True:
       
   179         entry = stream.read(entrysize)
       
   180         if len(entry) < entrysize:
       
   181             if entry:
       
   182                 raise error.Abort(_('bad phase-heads stream'))
       
   183             break
       
   184         phase, node = _fphasesentry.unpack(entry)
       
   185         headsbyphase[phase].append(node)
       
   186     return headsbyphase
   171 
   187 
   172 def _trackphasechange(data, rev, old, new):
   188 def _trackphasechange(data, rev, old, new):
   173     """add a phase move the <data> dictionnary
   189     """add a phase move the <data> dictionnary
   174 
   190 
   175     If data is None, nothing happens.
   191     If data is None, nothing happens.