git_handler: replace with-statement with try-finally

Python 2.4 does not have a with-statement
This commit is contained in:
Jordi Gutiérrez Hermoso 2012-10-18 12:25:04 -04:00
parent 9f2907f1f1
commit 8ab8c36d60

View File

@ -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