« July 2009
SunMonTueWedThuFriSat
   
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today
XML

Neat blogs

Navigation

Editing

Powered by Roller Weblogger.

statcounter.com

clustrmaps.com

Locations of visitors to this page

technorati.com

20081120 Thursday November 20, 2008
Locking down a gate/respository

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.


Originally posted on Kool Aid Served Daily
Copyright (C) 2008, Kool Aid Served Daily

Trackback URL: http://blogs.sun.com/tdh/entry/locking_down_a_gate_respository
Comments:

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 #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed