mercurial/exchange.py
changeset 44060 a61287a95dc3
parent 43913 4b7d5d10c45d
child 44282 877805928f85
equal deleted inserted replaced
44059:7126d8b8e0e6 44060:a61287a95dc3
     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 collections
    10 import collections
    11 import hashlib
       
    12 
    11 
    13 from .i18n import _
    12 from .i18n import _
    14 from .node import (
    13 from .node import (
    15     hex,
    14     hex,
    16     nullid,
    15     nullid,
    38     url as urlmod,
    37     url as urlmod,
    39     util,
    38     util,
    40     wireprototypes,
    39     wireprototypes,
    41 )
    40 )
    42 from .interfaces import repository
    41 from .interfaces import repository
    43 from .utils import stringutil
    42 from .utils import (
       
    43     hashutil,
       
    44     stringutil,
       
    45 )
    44 
    46 
    45 urlerr = util.urlerr
    47 urlerr = util.urlerr
    46 urlreq = util.urlreq
    48 urlreq = util.urlreq
    47 
    49 
    48 _NARROWACL_SECTION = b'narrowacl'
    50 _NARROWACL_SECTION = b'narrowacl'
  2703     """check if the heads of a repo have been modified
  2705     """check if the heads of a repo have been modified
  2704 
  2706 
  2705     Used by peer for unbundling.
  2707     Used by peer for unbundling.
  2706     """
  2708     """
  2707     heads = repo.heads()
  2709     heads = repo.heads()
  2708     heads_hash = hashlib.sha1(b''.join(sorted(heads))).digest()
  2710     heads_hash = hashutil.sha1(b''.join(sorted(heads))).digest()
  2709     if not (
  2711     if not (
  2710         their_heads == [b'force']
  2712         their_heads == [b'force']
  2711         or their_heads == heads
  2713         or their_heads == heads
  2712         or their_heads == [b'hashed', heads_hash]
  2714         or their_heads == [b'hashed', heads_hash]
  2713     ):
  2715     ):