mercurial/subrepo.py
changeset 23366 568ae89797c6
parent 23365 2ff394bbfa74
child 23367 115af8de76a4
equal deleted inserted replaced
23365:2ff394bbfa74 23366:568ae89797c6
    29     return path
    29     return path
    30 
    30 
    31 def _getstorehashcachename(remotepath):
    31 def _getstorehashcachename(remotepath):
    32     '''get a unique filename for the store hash cache of a remote repository'''
    32     '''get a unique filename for the store hash cache of a remote repository'''
    33     return util.sha1(_expandedabspath(remotepath)).hexdigest()[0:12]
    33     return util.sha1(_expandedabspath(remotepath)).hexdigest()[0:12]
    34 
       
    35 def _calcfilehash(filename):
       
    36     data = ''
       
    37     if os.path.exists(filename):
       
    38         fd = open(filename, 'rb')
       
    39         try:
       
    40             data = fd.read()
       
    41         finally:
       
    42             fd.close()
       
    43     return util.sha1(data).hexdigest()
       
    44 
    34 
    45 class SubrepoAbort(error.Abort):
    35 class SubrepoAbort(error.Abort):
    46     """Exception class used to avoid handling a subrepo error more than once"""
    36     """Exception class used to avoid handling a subrepo error more than once"""
    47     def __init__(self, *args, **kw):
    37     def __init__(self, *args, **kw):
    48         error.Abort.__init__(self, *args, **kw)
    38         error.Abort.__init__(self, *args, **kw)