Mercurial > hg > mercurial-crew-with-dirclash
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 +++ b/mercurial/commands.py @@ -880,6 +880,8 @@ def serve(ui, repo, **opts): fout.write(v) fout.flush() + lock = None + while 1: cmd = fin.readline()[:-1] if cmd == '': @@ -887,6 +889,13 @@ def serve(ui, repo, **opts): 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(" "))