equal
deleted
inserted
replaced
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 |
12 import os |
13 import os |
13 import posixpath |
14 import posixpath |
14 import re |
15 import re |
15 import stat |
16 import stat |
16 import subprocess |
17 import subprocess |
48 path = util.normpath(os.path.abspath(u.path)) |
49 path = util.normpath(os.path.abspath(u.path)) |
49 return path |
50 return path |
50 |
51 |
51 def _getstorehashcachename(remotepath): |
52 def _getstorehashcachename(remotepath): |
52 '''get a unique filename for the store hash cache of a remote repository''' |
53 '''get a unique filename for the store hash cache of a remote repository''' |
53 return util.sha1(_expandedabspath(remotepath)).hexdigest()[0:12] |
54 return hashlib.sha1(_expandedabspath(remotepath)).hexdigest()[0:12] |
54 |
55 |
55 class SubrepoAbort(error.Abort): |
56 class SubrepoAbort(error.Abort): |
56 """Exception class used to avoid handling a subrepo error more than once""" |
57 """Exception class used to avoid handling a subrepo error more than once""" |
57 def __init__(self, *args, **kw): |
58 def __init__(self, *args, **kw): |
58 error.Abort.__init__(self, *args, **kw) |
59 error.Abort.__init__(self, *args, **kw) |
657 # sort the files that will be hashed in increasing (likely) file size |
658 # sort the files that will be hashed in increasing (likely) file size |
658 filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i') |
659 filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i') |
659 yield '# %s\n' % _expandedabspath(remotepath) |
660 yield '# %s\n' % _expandedabspath(remotepath) |
660 vfs = self._repo.vfs |
661 vfs = self._repo.vfs |
661 for relname in filelist: |
662 for relname in filelist: |
662 filehash = util.sha1(vfs.tryread(relname)).hexdigest() |
663 filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest() |
663 yield '%s = %s\n' % (relname, filehash) |
664 yield '%s = %s\n' % (relname, filehash) |
664 |
665 |
665 @propertycache |
666 @propertycache |
666 def _cachestorehashvfs(self): |
667 def _cachestorehashvfs(self): |
667 return scmutil.vfs(self._repo.join('cache/storehash')) |
668 return scmutil.vfs(self._repo.join('cache/storehash')) |