changeset 8411:4d5916358abd

commit: move lots of commitctx outside of the repo lock
author Matt Mackall <mpm@selenic.com>
date Thu, 14 May 2009 13:21:20 -0500
parents 1d11d985c179
children 2bf4f380f6ab
files mercurial/localrepo.py
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu May 14 13:21:20 2009 -0500
+++ b/mercurial/localrepo.py	Thu May 14 13:21:20 2009 -0500
@@ -826,29 +826,29 @@
         If working is set, the working directory is affected.
         """
 
-        lock = self.lock()
         tr = None
         valid = 0 # don't save the dirstate if this isn't set
-        try:
-            commit = sorted(ctx.modified() + ctx.added())
-            remove = ctx.removed()
-            extra = ctx.extra().copy()
-            branchname = extra['branch']
-            user = ctx.user()
-            text = ctx.description()
+        lock = None
+        commit = sorted(ctx.modified() + ctx.added())
+        remove = ctx.removed()
+        extra = ctx.extra().copy()
+        branchname = extra['branch']
+        user = ctx.user()
+        text = ctx.description()
 
-            p1, p2 = [p.node() for p in ctx.parents()]
-            c1 = self.changelog.read(p1)
-            c2 = self.changelog.read(p2)
-            m1 = self.manifest.read(c1[0]).copy()
-            m2 = self.manifest.read(c2[0])
+        p1, p2 = [p.node() for p in ctx.parents()]
+        c1 = self.changelog.read(p1)
+        c2 = self.changelog.read(p2)
+        m1 = self.manifest.read(c1[0]).copy()
+        m2 = self.manifest.read(c2[0])
 
-            xp1 = hex(p1)
-            if p2 == nullid: xp2 = ''
-            else: xp2 = hex(p2)
+        xp1 = hex(p1)
+        if p2 == nullid: xp2 = ''
+        else: xp2 = hex(p2)
+        self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
 
-            self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
-
+        lock = self.lock()
+        try:
             tr = self.transaction()
             trp = weakref.proxy(tr)