mercurial/subrepo.py
changeset 44060 a61287a95dc3
parent 44009 e685fac56693
child 44434 2f290136b7d6
equal deleted inserted replaced
44059:7126d8b8e0e6 44060:a61287a95dc3
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
    10 import copy
    10 import copy
    11 import errno
    11 import errno
    12 import hashlib
       
    13 import os
    12 import os
    14 import re
    13 import re
    15 import stat
    14 import stat
    16 import subprocess
    15 import subprocess
    17 import sys
    16 import sys
    35     util,
    34     util,
    36     vfs as vfsmod,
    35     vfs as vfsmod,
    37 )
    36 )
    38 from .utils import (
    37 from .utils import (
    39     dateutil,
    38     dateutil,
       
    39     hashutil,
    40     procutil,
    40     procutil,
    41     stringutil,
    41     stringutil,
    42 )
    42 )
    43 
    43 
    44 hg = None
    44 hg = None
    59     return path
    59     return path
    60 
    60 
    61 
    61 
    62 def _getstorehashcachename(remotepath):
    62 def _getstorehashcachename(remotepath):
    63     '''get a unique filename for the store hash cache of a remote repository'''
    63     '''get a unique filename for the store hash cache of a remote repository'''
    64     return node.hex(hashlib.sha1(_expandedabspath(remotepath)).digest())[0:12]
    64     return node.hex(hashutil.sha1(_expandedabspath(remotepath)).digest())[0:12]
    65 
    65 
    66 
    66 
    67 class SubrepoAbort(error.Abort):
    67 class SubrepoAbort(error.Abort):
    68     """Exception class used to avoid handling a subrepo error more than once"""
    68     """Exception class used to avoid handling a subrepo error more than once"""
    69 
    69 
   512         # sort the files that will be hashed in increasing (likely) file size
   512         # sort the files that will be hashed in increasing (likely) file size
   513         filelist = (b'bookmarks', b'store/phaseroots', b'store/00changelog.i')
   513         filelist = (b'bookmarks', b'store/phaseroots', b'store/00changelog.i')
   514         yield b'# %s\n' % _expandedabspath(remotepath)
   514         yield b'# %s\n' % _expandedabspath(remotepath)
   515         vfs = self._repo.vfs
   515         vfs = self._repo.vfs
   516         for relname in filelist:
   516         for relname in filelist:
   517             filehash = node.hex(hashlib.sha1(vfs.tryread(relname)).digest())
   517             filehash = node.hex(hashutil.sha1(vfs.tryread(relname)).digest())
   518             yield b'%s = %s\n' % (relname, filehash)
   518             yield b'%s = %s\n' % (relname, filehash)
   519 
   519 
   520     @propertycache
   520     @propertycache
   521     def _cachestorehashvfs(self):
   521     def _cachestorehashvfs(self):
   522         return vfsmod.vfs(self._repo.vfs.join(b'cache/storehash'))
   522         return vfsmod.vfs(self._repo.vfs.join(b'cache/storehash'))