Mercurial > hg > mercurial-crew-with-dirclash
annotate mercurial/lock.py @ 586:11578820b5d7
[PATCH] Tags template cleanup
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[PATCH] Tags template cleanup
From: Edouard Gomez <edouard.gomez@gmail.com>
Tags template cleanup
This page lists all tags, thus using divs doesn't structure well
the information. Better use a list (ul). Each tag becomes a li
element. The li element also carries the parity information.
As font style tags are highly deprecated in newer HTML variants
get rid of the tt element, relaced by a simple span that gets
a CSS class that mimics tt default style (monospaced text)
Added CSS classes required to match old style.
manifest hash: f8943b8270e20966a04111e7205deefedd8b7075
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCx1ijywK+sNU5EO8RAjaAAJoCVaD37YUC6DueL6Kd5D9aoCF8bQCfSWw0
xFVkpEtnr6ST4eyJjR8K17U=
=nphb
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Sat, 02 Jul 2005 19:16:51 -0800 |
parents | 03f27b1381f9 |
children | 5ca319a641e1 574869103985 |
rev | line source |
---|---|
161 | 1 # lock.py - simple locking scheme for mercurial |
2 # | |
3 # Copyright 2005 Matt Mackall <mpm@selenic.com> | |
4 # | |
5 # This software may be used and distributed according to the terms | |
6 # of the GNU General Public License, incorporated herein by reference. | |
7 | |
8 import os, time | |
422
10c43444a38e
[PATCH] Enables lock work under the other 'OS'
mpm@selenic.com
parents:
161
diff
changeset
|
9 import util |
161 | 10 |
11 class LockHeld(Exception): | |
12 pass | |
13 | |
14 class lock: | |
15 def __init__(self, file, wait = 1): | |
16 self.f = file | |
17 self.held = 0 | |
18 self.wait = wait | |
19 self.lock() | |
20 | |
21 def __del__(self): | |
22 self.release() | |
23 | |
24 def lock(self): | |
25 while 1: | |
26 try: | |
27 self.trylock() | |
28 return 1 | |
29 except LockHeld, inst: | |
30 if self.wait: | |
31 time.sleep(1) | |
32 continue | |
33 raise inst | |
515 | 34 |
161 | 35 def trylock(self): |
36 pid = os.getpid() | |
37 try: | |
422
10c43444a38e
[PATCH] Enables lock work under the other 'OS'
mpm@selenic.com
parents:
161
diff
changeset
|
38 util.makelock(str(pid), self.f) |
161 | 39 self.held = 1 |
40 except: | |
422
10c43444a38e
[PATCH] Enables lock work under the other 'OS'
mpm@selenic.com
parents:
161
diff
changeset
|
41 raise LockHeld(util.readlock(self.f)) |
161 | 42 |
43 def release(self): | |
44 if self.held: | |
45 self.held = 0 | |
503
c6a2e41c8c60
Fix troubles with clone and exception handling
mpm@selenic.com
parents:
429
diff
changeset
|
46 try: |
c6a2e41c8c60
Fix troubles with clone and exception handling
mpm@selenic.com
parents:
429
diff
changeset
|
47 os.unlink(self.f) |
c6a2e41c8c60
Fix troubles with clone and exception handling
mpm@selenic.com
parents:
429
diff
changeset
|
48 except: pass |
161 | 49 |