# HG changeset patch # User Jordi Gutiérrez Hermoso <jordigh@octave.org> # Date 1350577504 14400 # Thu Oct 18 12:25:04 2012 -0400 # Node ID cac070a4b5219b86d4999722bbe1ca7f34e55697 # Parent f3f344aac42be16d02458752c422e5f4a8d3c599 git_handler: replace with-statement with try-finally Python 2.4 does not have a with-statement diff --git a/hggit/git_handler.py b/hggit/git_handler.py --- 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