changeset 27871:f1c316fd91f9

with: use context manager in rebuildfncache
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents ed9950ba091e
children a54afc4475d7
files mercurial/repair.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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'))