mercurial/wireprotov1peer.py
changeset 44060 a61287a95dc3
parent 43506 9f70512ae2cf
child 45942 89a2afe31e82
equal deleted inserted replaced
44059:7126d8b8e0e6 44060:a61287a95dc3
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
    10 import hashlib
       
    11 import sys
    10 import sys
    12 import weakref
    11 import weakref
    13 
    12 
    14 from .i18n import _
    13 from .i18n import _
    15 from .node import bin
    14 from .node import bin
    29 )
    28 )
    30 from .interfaces import (
    29 from .interfaces import (
    31     repository,
    30     repository,
    32     util as interfaceutil,
    31     util as interfaceutil,
    33 )
    32 )
       
    33 from .utils import hashutil
    34 
    34 
    35 urlreq = util.urlreq
    35 urlreq = util.urlreq
    36 
    36 
    37 
    37 
    38 def batchable(f):
    38 def batchable(f):
   487         visible to hooks.
   487         visible to hooks.
   488         '''
   488         '''
   489 
   489 
   490         if heads != [b'force'] and self.capable(b'unbundlehash'):
   490         if heads != [b'force'] and self.capable(b'unbundlehash'):
   491             heads = wireprototypes.encodelist(
   491             heads = wireprototypes.encodelist(
   492                 [b'hashed', hashlib.sha1(b''.join(sorted(heads))).digest()]
   492                 [b'hashed', hashutil.sha1(b''.join(sorted(heads))).digest()]
   493             )
   493             )
   494         else:
   494         else:
   495             heads = wireprototypes.encodelist(heads)
   495             heads = wireprototypes.encodelist(heads)
   496 
   496 
   497         if util.safehasattr(bundle, b'deltaheader'):
   497         if util.safehasattr(bundle, b'deltaheader'):