diff mercurial/sshserver.py @ 11442:ee1ed6afac21 stable

addchangegroup: pass in lock to release it before changegroup hook is called Currently, callers of addchangegroup first acquire the repository lock, usually to check that an unbundle request isn't racing. This means that changegroup hook actions that might write to a repo get stuck waiting for a lock. Here, we add a new optional lock parameter and update all the callers. Post-1.6 we may make it non-optional.
author Matt Mackall <mpm@selenic.com>
date Fri, 25 Jun 2010 13:47:28 -0500
parents 02a4373ca5cd
children c19d7e91cc46
line wrap: on
line diff
--- a/mercurial/sshserver.py	Thu Jun 24 15:18:47 2010 +0100
+++ b/mercurial/sshserver.py	Fri Jun 25 13:47:28 2010 -0500
@@ -161,7 +161,8 @@
             return
 
         self.respond("")
-        r = self.repo.addchangegroup(self.fin, 'serve', self.client_url())
+        r = self.repo.addchangegroup(self.fin, 'serve', self.client_url(),
+                                     lock=self.lock)
         self.respond(str(r))
 
     def client_url(self):
@@ -205,7 +206,8 @@
                 # push can proceed
 
                 fp.seek(0)
-                r = self.repo.addchangegroup(fp, 'serve', self.client_url())
+                r = self.repo.addchangegroup(fp, 'serve', self.client_url(),
+                                             lock=self.lock)
                 self.respond(str(r))
             finally:
                 if not was_locked: