So I'm not a mean gatekeeper - I try to not lock down our gate. I feel like I should just be able to ask people not to integrate anything. But the reality is that you can't count on everyone getting the message. So, you need to lock down the gate.
I knew how to do that in Teamware, but I've never had that need with Mercurial. Until today that is - a nasty branch merge with onnv_103.
So to lock down a Mercurial gate with Sun's extensions, you can use lock.py:
[nfs4hg@aus1500-home ~]> which lock.py /pool/nfs4hg/bin/lock.py [nfs4hg@aus1500-home nfs41-gate]> lock.py -n -R /pool/ws/nfs41-gate [write]: None
Okay, no one has a write lock, so let's grab one:
[nfs4hg@aus1500-home nfs41-gate]> lock.py -R /pool/ws/nfs41-gate
[nfs4hg@aus1500-home nfs41-gate]> lock.py -n -R /pool/ws/nfs41-gate
[write]:
nfs4hg
th199096
By the way, where is this configured?
[nfs4hg@aus1500-home ~]> grep lock /pool/ws/nfs41-gate/.hg/hgrc # 5. lockdir must be readable by whomever will pull/push lockdir = public/lock wlock = nfs4hg, th199096 # These hooks check the lock before anything happens. prechangegroup.0 = python:hook.lockchk.lockchk # then comment it out, let them push, uncomment, and unlock the gate.
So the lock only works on the gate and not the clone. You can find more about this in the source of lock.py.
Ohh, and even though I haven't tested it, you release the gate easily enough with a unlock.py.
Hm...I was sure that with mercurial you do not need locks at all. Each commit is a transaction and you will never endup into inconsistent state on checkouts for builds.
Oh i see, you probably want to merge locally and push changes back and want to be sure that nobody modified the tip...
Thanks for the hint!
Posted by Tigran Mkrtchyan on November 20, 2008 at 01:44 PM CST #
Tigran,
Exactly!
Tom
Posted by Tom Haynes on November 20, 2008 at 01:49 PM CST #