From 8ab8c36d60d33fa0eb2f398e5a03c537b99f7002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Guti=C3=A9rrez=20Hermoso?= Date: Thu, 18 Oct 2012 12:25:04 -0400 Subject: [PATCH] git_handler: replace with-statement with try-finally Python 2.4 does not have a with-statement --- hggit/git_handler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hggit/git_handler.py b/hggit/git_handler.py index 896573b443..f68b057b0e 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -133,15 +133,17 @@ class GitHandler(object): 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 + finally: + f.close() ## FILE LOAD AND SAVE METHODS