mercurial/subrepo.py
changeset 35582 72b91f905065
parent 35371 c999d246e48c
child 35585 35fb3367f72d
equal deleted inserted replaced
35581:154754d1f137 35582:72b91f905065
    53         path = util.normpath(os.path.abspath(u.path))
    53         path = util.normpath(os.path.abspath(u.path))
    54     return path
    54     return path
    55 
    55 
    56 def _getstorehashcachename(remotepath):
    56 def _getstorehashcachename(remotepath):
    57     '''get a unique filename for the store hash cache of a remote repository'''
    57     '''get a unique filename for the store hash cache of a remote repository'''
    58     return hashlib.sha1(_expandedabspath(remotepath)).hexdigest()[0:12]
    58     return node.hex(hashlib.sha1(_expandedabspath(remotepath)).digest())[0:12]
    59 
    59 
    60 class SubrepoAbort(error.Abort):
    60 class SubrepoAbort(error.Abort):
    61     """Exception class used to avoid handling a subrepo error more than once"""
    61     """Exception class used to avoid handling a subrepo error more than once"""
    62     def __init__(self, *args, **kw):
    62     def __init__(self, *args, **kw):
    63         self.subrepo = kw.pop(r'subrepo', None)
    63         self.subrepo = kw.pop(r'subrepo', None)
   787         # sort the files that will be hashed in increasing (likely) file size
   787         # sort the files that will be hashed in increasing (likely) file size
   788         filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i')
   788         filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i')
   789         yield '# %s\n' % _expandedabspath(remotepath)
   789         yield '# %s\n' % _expandedabspath(remotepath)
   790         vfs = self._repo.vfs
   790         vfs = self._repo.vfs
   791         for relname in filelist:
   791         for relname in filelist:
   792             filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest()
   792             filehash = node.hex(hashlib.sha1(vfs.tryread(relname)).digest())
   793             yield '%s = %s\n' % (relname, filehash)
   793             yield '%s = %s\n' % (relname, filehash)
   794 
   794 
   795     @propertycache
   795     @propertycache
   796     def _cachestorehashvfs(self):
   796     def _cachestorehashvfs(self):
   797         return vfsmod.vfs(self._repo.vfs.join('cache/storehash'))
   797         return vfsmod.vfs(self._repo.vfs.join('cache/storehash'))