with: use context manager in rebuildfncache
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:49 -0800
changeset 27871 f1c316fd91f9
parent 27870 ed9950ba091e
child 27872 a54afc4475d7
with: use context manager in rebuildfncache
mercurial/repair.py
--- a/mercurial/repair.py	Fri Jan 15 13:14:49 2016 -0800
+++ b/mercurial/repair.py	Fri Jan 15 13:14:49 2016 -0800
@@ -296,12 +296,8 @@
             fnc.entries = newentries
             fnc._dirty = True
 
-            tr = repo.transaction('fncache')
-            try:
+            with repo.transaction('fncache') as tr:
                 fnc.write(tr)
-                tr.close()
-            finally:
-                tr.release()
         else:
             ui.write(_('fncache already up to date\n'))