mercurial/subrepo.py
changeset 21887 9aaffb22d7d7
parent 21886 b9e8fdc35daf
child 21888 dfb8f757750c
equal deleted inserted replaced
21886:b9e8fdc35daf 21887:9aaffb22d7d7
    33 
    33 
    34 def _calcfilehash(filename):
    34 def _calcfilehash(filename):
    35     data = ''
    35     data = ''
    36     if os.path.exists(filename):
    36     if os.path.exists(filename):
    37         fd = open(filename, 'rb')
    37         fd = open(filename, 'rb')
    38         data = fd.read()
    38         try:
    39         fd.close()
    39             data = fd.read()
       
    40         finally:
       
    41             fd.close()
    40     return util.sha1(data).hexdigest()
    42     return util.sha1(data).hexdigest()
    41 
    43 
    42 class SubrepoAbort(error.Abort):
    44 class SubrepoAbort(error.Abort):
    43     """Exception class used to avoid handling a subrepo error more than once"""
    45     """Exception class used to avoid handling a subrepo error more than once"""
    44     def __init__(self, *args, **kw):
    46     def __init__(self, *args, **kw):