Mercurial > hg > hg-git
changeset 554:cac070a4b521
git_handler: replace with-statement with try-finally
Python 2.4 does not have a with-statement
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 18 Oct 2012 12:25:04 -0400 |
parents | f3f344aac42b |
children | 9f919924bf81 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -133,15 +133,17 @@ 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