hgext/mq.py
changeset 14620 2b9c32929e62
parent 14600 17c16bcf6926
child 14635 217b7d83afc3
--- a/hgext/mq.py	Tue Jun 14 20:08:35 2011 -0300
+++ b/hgext/mq.py	Wed Jun 15 01:50:49 2011 +0900
@@ -2275,9 +2275,13 @@
         # We don't want to lose the patch message if qrefresh fails (issue2062)
         repo.savecommitmessage(message)
     setupheaderopts(ui, opts)
-    ret = q.refresh(repo, pats, msg=message, **opts)
-    q.savedirty()
-    return ret
+    wlock = repo.wlock()
+    try:
+        ret = q.refresh(repo, pats, msg=message, **opts)
+        q.savedirty()
+        return ret
+    finally:
+        wlock.release()
 
 @command("^qdiff",
          commands.diffopts + commands.diffopts2 + commands.walkopts,
@@ -2366,9 +2370,13 @@
         message = ui.edit(message, user or ui.username())
 
     diffopts = q.patchopts(q.diffopts(), *patches)
-    q.refresh(repo, msg=message, git=diffopts.git)
-    q.delete(repo, patches, opts)
-    q.savedirty()
+    wlock = repo.wlock()
+    try:
+        q.refresh(repo, msg=message, git=diffopts.git)
+        q.delete(repo, patches, opts)
+        q.savedirty()
+    finally:
+        wlock.release()
 
 @command("qgoto",
          [('f', 'force', None, _('overwrite any local changes'))],