mercurial/pvec.py
changeset 32245 4462a981e8df
parent 27501 983e93d88193
child 38823 e7aa113b14f7
equal deleted inserted replaced
32244:2d84947cd85d 32245:4462a981e8df
    50 
    50 
    51 from __future__ import absolute_import
    51 from __future__ import absolute_import
    52 
    52 
    53 from .node import nullrev
    53 from .node import nullrev
    54 from . import (
    54 from . import (
    55     base85,
       
    56     util,
    55     util,
    57 )
    56 )
    58 
    57 
    59 _size = 448 # 70 chars b85-encoded
    58 _size = 448 # 70 chars b85-encoded
    60 _bytes = _size / 8
    59 _bytes = _size / 8
   164                     d, v = pvc[p1]
   163                     d, v = pvc[p1]
   165                     pvc[n] = (d + 1, _flipbit(v, node))
   164                     pvc[n] = (d + 1, _flipbit(v, node))
   166                 else:
   165                 else:
   167                     pvc[n] = _mergevec(pvc[p1], pvc[p2], node)
   166                     pvc[n] = _mergevec(pvc[p1], pvc[p2], node)
   168     bs = _join(*pvc[ctx.rev()])
   167     bs = _join(*pvc[ctx.rev()])
   169     return pvec(base85.b85encode(bs))
   168     return pvec(util.b85encode(bs))
   170 
   169 
   171 class pvec(object):
   170 class pvec(object):
   172     def __init__(self, hashorctx):
   171     def __init__(self, hashorctx):
   173         if isinstance(hashorctx, str):
   172         if isinstance(hashorctx, str):
   174             self._bs = hashorctx
   173             self._bs = hashorctx
   175             self._depth, self._vec = _split(base85.b85decode(hashorctx))
   174             self._depth, self._vec = _split(util.b85decode(hashorctx))
   176         else:
   175         else:
   177             self._vec = ctxpvec(hashorctx)
   176             self._vec = ctxpvec(hashorctx)
   178 
   177 
   179     def __str__(self):
   178     def __str__(self):
   180         return self._bs
   179         return self._bs