diff mercurial/commands.py @ 638:35f7adfefa69

Add a scheme for handling remote locking This adds an object that remembers to unlock the remote repo on destruction and lock/unlock functions for the ssh protocol. The remote repository should also unlock itself when the connection goes down.
author Matt Mackall <mpm@selenic.com>
date Wed, 06 Jul 2005 22:23:27 -0800
parents 85e2209d401c
children 31cebba881a0
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jul 06 22:21:23 2005 -0800
+++ b/mercurial/commands.py	Wed Jul 06 22:23:27 2005 -0800
@@ -880,6 +880,8 @@
             fout.write(v)
             fout.flush()
 
+        lock = None
+
         while 1:
             cmd = fin.readline()[:-1]
             if cmd == '':
@@ -887,6 +889,13 @@
             if cmd == "heads":
                 h = repo.heads()
                 respond(" ".join(map(hg.hex, h)) + "\n")
+            if cmd == "lock":
+                lock = repo.lock()
+                respond("")
+            if cmd == "unlock":
+                if lock: lock.release()
+                lock = None
+                respond("")
             elif cmd == "branches":
                 arg, nodes = getarg()
                 nodes = map(hg.bin, nodes.split(" "))