commit: move some setup outside the lock
authorMatt Mackall <mpm@selenic.com>
Thu, 04 Jun 2009 16:21:03 -0500
changeset 8715 8c667f4c482e
parent 8714 505a96cbc923
child 8716 f3322bb29a0e
commit: move some setup outside the lock
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Jun 04 21:23:31 2009 +0900
+++ b/mercurial/localrepo.py	Thu Jun 04 16:21:03 2009 -0500
@@ -782,6 +782,17 @@
         supplied, it is called to get a commit message.
         """
 
+        def fail(f, msg):
+            raise util.Abort('%s: %s' % (f, msg))
+
+        if not match:
+            match = match_.always(self.root, '')
+
+        if not force:
+            vdirs = []
+            match.dir = vdirs.append
+            match.bad = fail
+
         wlock = self.wlock()
         try:
             p1, p2 = self.dirstate.parents()
@@ -791,17 +802,6 @@
                 raise util.Abort(_('cannot partially commit a merge '
                                    '(do not specify files or patterns)'))
 
-            def fail(f, msg):
-                raise util.Abort('%s: %s' % (f, msg))
-
-            if not match:
-                match = match_.always(self.root, '')
-
-            if not force:
-                vdirs = []
-                match.dir = vdirs.append
-                match.bad = fail
-
             changes = self.status(match=match, clean=force)
             if force:
                 changes[0].extend(changes[6]) # mq may commit unchanged files