comparison mercurial/hgweb/hgweb_mod.py @ 4959:97b734fb9c6f

Use try/finally pattern to cleanup locks and transactions
author Matt Mackall <mpm@selenic.com>
date Sat, 21 Jul 2007 16:02:10 -0500
parents d9e385a7a806
children 79373ec3f27d
comparison
equal deleted inserted replaced
4958:9a2a73ea6135 4959:97b734fb9c6f
1166 val = sys.stdout.getvalue() 1166 val = sys.stdout.getvalue()
1167 sys.stdout = old_stdout 1167 sys.stdout = old_stdout
1168 req.write('%d\n' % ret) 1168 req.write('%d\n' % ret)
1169 req.write(val) 1169 req.write(val)
1170 finally: 1170 finally:
1171 lock.release() 1171 del lock
1172 except (OSError, IOError), inst: 1172 except (OSError, IOError), inst:
1173 req.write('0\n') 1173 req.write('0\n')
1174 filename = getattr(inst, 'filename', '') 1174 filename = getattr(inst, 'filename', '')
1175 # Don't send our filesystem layout to the client 1175 # Don't send our filesystem layout to the client
1176 if filename.startswith(self.repo.root): 1176 if filename.startswith(self.repo.root):