changeset 743:06f84f38c6dc

git_handler: clean up coding style
author Augie Fackler <raf@durin42.com>
date Mon, 30 Jul 2012 08:20:08 -0500
parents ab8562b11c4f
children c7ea22aa3440
files hggit/git_handler.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -136,17 +136,13 @@
     def init_author_file(self):
         self.author_map = {}
         if self.ui.config('git', 'authors'):
-            f = open(self.repo.wjoin(
-                self.ui.config('git', 'authors')))
-            try:
+            with open(self.repo.wjoin(self.ui.config('git', 'authors'))) as f:
                 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