changeset 27833:321759dfc049

with: use context manager for lock in histedit cleanupnode
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 1e38b9d731c4
children 476f53058ee8
files hgext/histedit.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/histedit.py	Fri Jan 15 13:14:47 2016 -0800
@@ -1471,9 +1471,7 @@
     The set of node to strip may contains unknown nodes."""
     ui.debug('should strip %s nodes %s\n' %
              (name, ', '.join([node.short(n) for n in nodes])))
-    lock = None
-    try:
-        lock = repo.lock()
+    with repo.lock():
         # do not let filtering get in the way of the cleanse
         # we should probably get rid of obsolescence marker created during the
         # histedit, but we currently do not have such information.
@@ -1488,8 +1486,6 @@
             # but this trigger a bug in changegroup hook.
             # This would reduce bundle overhead
             repair.strip(ui, repo, c)
-    finally:
-        release(lock)
 
 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
     if isinstance(nodelist, str):