with: use context manager in manifest
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:49 -0800
changeset 29800 7575c048482db03478121bfa9058d09a71498004
parent 29799 b0b98e0a12f8148df78a3d05d44614b913087872
child 29801 f55a5ace8e69bd56bcf3e454745c857c8fea7b7c
push id172
push usergszorc@mozilla.com
push dateMon, 18 Jan 2016 03:58:21 +0000
with: use context manager in manifest
mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5113,23 +5113,20 @@ def manifest(ui, repo, node=None, rev=No
         if rev or node:
             raise error.Abort(_("can't specify a revision with --all"))
 
         res = []
         prefix = "data/"
         suffix = ".i"
         plen = len(prefix)
         slen = len(suffix)
-        lock = repo.lock()
-        try:
+        with repo.lock():
             for fn, b, size in repo.store.datafiles():
                 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix:
                     res.append(fn[plen:-slen])
-        finally:
-            lock.release()
         for f in res:
             fm.startitem()
             fm.write("path", '%s\n', f)
         fm.end()
         return
 
     if rev and node:
         raise error.Abort(_("please specify just one revision"))