Browse Source

Update hooks.py

python2.4 compat for hooks.py

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Marcin Kuźmiński 11 years ago
parent
commit
8362a203ed
1 changed files with 4 additions and 1 deletions
  1. 4 1
      dulwich/hooks.py

+ 4 - 1
dulwich/hooks.py

@@ -137,8 +137,11 @@ class CommitMsgShellHook(ShellHook):
 
         def clean_msg(success, *args):
             if success:
-                with open(args[0], 'rb') as f:
+                f = open(args[0], 'rb')
+                try:
                     new_msg = f.read()
+                finally:
+                    f.close()
                 os.unlink(args[0])
                 return new_msg
             os.unlink(args[0])