diff --git a/hggit/git_handler.py b/hggit/git_handler.py index f3f344aac42be16d02458752c422e5f4a8d3c599_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..cac070a4b5219b86d4999722bbe1ca7f34e55697_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -133,12 +133,12 @@ def init_author_file(self): self.author_map = {} if self.ui.config('git', 'authors'): - with open(self.repo.wjoin( - self.ui.config('git', 'authors') - )) as f: + f = open(self.repo.wjoin( + self.ui.config('git', 'authors'))) + try: for line in f: line = line.strip() if not line or line.startswith('#'): continue from_, to = RE_AUTHOR_FILE.split(line, 2) self.author_map[from_] = to @@ -139,9 +139,11 @@ for line in f: line = line.strip() if not line or line.startswith('#'): continue from_, to = RE_AUTHOR_FILE.split(line, 2) self.author_map[from_] = to + finally: + f.close() ## FILE LOAD AND SAVE METHODS