hgext/remotefilelog/fileserverclient.py
changeset 44062 2d49482d0dd4
parent 44001 faf00e30b63f
child 45942 89a2afe31e82
equal deleted inserted replaced
44061:cbc5755df6bf 44062:2d49482d0dd4
     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 io
    10 import io
    12 import os
    11 import os
    13 import threading
    12 import threading
    14 import time
    13 import time
    15 import zlib
    14 import zlib
    23     revlog,
    22     revlog,
    24     sshpeer,
    23     sshpeer,
    25     util,
    24     util,
    26     wireprotov1peer,
    25     wireprotov1peer,
    27 )
    26 )
    28 from mercurial.utils import procutil
    27 from mercurial.utils import (
       
    28     hashutil,
       
    29     procutil,
       
    30 )
    29 
    31 
    30 from . import (
    32 from . import (
    31     constants,
    33     constants,
    32     contentstore,
    34     contentstore,
    33     metadatastore,
    35     metadatastore,
    43 
    45 
    44 _lfsmod = None
    46 _lfsmod = None
    45 
    47 
    46 
    48 
    47 def getcachekey(reponame, file, id):
    49 def getcachekey(reponame, file, id):
    48     pathhash = node.hex(hashlib.sha1(file).digest())
    50     pathhash = node.hex(hashutil.sha1(file).digest())
    49     return os.path.join(reponame, pathhash[:2], pathhash[2:], id)
    51     return os.path.join(reponame, pathhash[:2], pathhash[2:], id)
    50 
    52 
    51 
    53 
    52 def getlocalkey(file, id):
    54 def getlocalkey(file, id):
    53     pathhash = node.hex(hashlib.sha1(file).digest())
    55     pathhash = node.hex(hashutil.sha1(file).digest())
    54     return os.path.join(pathhash, id)
    56     return os.path.join(pathhash, id)
    55 
    57 
    56 
    58 
    57 def peersetup(ui, peer):
    59 def peersetup(ui, peer):
    58     class remotefilepeer(peer.__class__):
    60     class remotefilepeer(peer.__class__):