[PATCH 17 of 19] mq: remove some redundant explicit wlocks - they are now locked automatically

Mads Kiilerich mads at kiilerich.com
Thu Jan 12 19:32:51 CST 2012


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1326245837 -3600
# Node ID d8fc79ea94e0c7179546af7c42ef02615770273a
# Parent  9ff0a0a1fe41ffec86acc76362b29c086151026d
mq: remove some redundant explicit wlocks - they are now locked automatically

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2283,11 +2283,7 @@
         # We don't want to lose the patch message if qrefresh fails (issue2062)
         repo.savecommitmessage(message)
     setupheaderopts(ui, opts)
-    wlock = repo.wlock()
-    try:
-        return q.refresh(repo, pats, msg=message, **opts)
-    finally:
-        wlock.release()
+    return q.refresh(repo, pats, msg=message, **opts)
 
 @command("^qdiff",
          commands.diffopts + commands.diffopts2 + commands.walkopts,
@@ -2375,12 +2371,8 @@
         message = ui.edit(message, user or ui.username())
 
     diffopts = q.patchopts(q.diffopts(), *patches)
-    wlock = repo.wlock()
-    try:
-        q.refresh(repo, msg=message, git=diffopts.git)
-        q.delete(repo, patches, opts)
-    finally:
-        wlock.release()
+    q.refresh(repo, msg=message, git=diffopts.git)
+    q.delete(repo, patches, opts)
 
 @command("qgoto",
          [('f', 'force', None, _('overwrite any local changes'))],
@@ -2769,14 +2761,10 @@
 
     revs = list(rootnodes)
     if update and opts.get('keep'):
-        wlock = repo.wlock()
-        try:
-            urev = repo.mq.qparents(repo, revs[0])
-            repo.dirstate.rebuild(urev, repo[urev].manifest())
-            repo.dirstate.write()
-            update = False
-        finally:
-            wlock.release()
+        urev = repo.mq.qparents(repo, revs[0])
+        repo.dirstate.rebuild(urev, repo[urev].manifest())
+        repo.dirstate.write()
+        update = False
 
     repo.mq.strip(repo, revs, backup=backup, update=update,
                   force=opts.get('force'))


More information about the Mercurial-devel mailing list