Commit Graph

16 Commits

Author SHA1 Message Date
Thomas Arendsen Hein
6046bbb871 Don't step into an endless loop when lock file is empty. 2006-11-20 19:36:28 +01:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Benoit Boissinot
7dd019b60b use __contains__, index or split instead of str.find
str.find return -1 when the substring is not found, -1 evaluate
to True and is a valid index, which can lead to bugs.
Using alternatives when possible makes the code clearer and less
prone to bugs. (and __contains__ is faster in microbenchmarks)
2006-07-09 01:30:30 +02:00
Vadim Gelfer
959e983875 fix backtrace printed when cannot get lock.
change lock error handling code so exceptions have useful info and
exception handling in one place.

add test case for when cannot get lock.
2006-03-28 09:01:07 -08:00
Vadim Gelfer
61a7953729 change lock format to let us detect and break stale locks.
old style: symlink to pid
new style: symlink to hostname:pid

if lock code finds new-style lock, it breaks lock if locking pid is on
same machine and pid is not alive.

otherwise, lock is left alone.  this makes locking code safe with
old-style locks and with locks on other machines.

new code makes server part of mercurial more robust in case machine
crashes, power fails, or crazy user does kill -9.
2006-03-10 08:31:31 -08:00
Vadim Gelfer
ecbcdd0c46 make lock module use demandload. 2006-03-05 01:37:28 -08:00
Benoit Boissinot
25acc6be22 add a timeout when a lock is held (default 1024 sec)
- change the wait keyword from lock.lock to timeout,
  a negative timeout of means "wait forever"
- refactor the two lock functions from localrepo.py
- make them use the timeout (default 1024, can be changed
  with ui.timeout in the config file
- update the doc
2006-02-21 23:21:15 +01:00
Benoit Boissinot
6f064de857 Raise a different exception when the lock is not available
When the filesystem is read-only or if we have some other
error, there is no need to wait.
Raise a lock.LockUnavailable exception.
2006-02-20 01:09:40 +01:00
Eric Hopper
dd6718fc31 Convert all classes to new-style classes by deriving them from object. 2005-11-18 22:48:47 -08:00
Benoit Boissinot
956119e446 add a releasefn keyword to lock.lock
releasefn is a function that will be executed when the lock is released
2005-11-11 15:34:09 -08:00
benoit.boissinot@ens-lyon.fr
95b97f01ed pep-0008 cleanup
- Don't use spaces around the '=' sign when used to indicate a
      keyword argument or a default parameter value.
2005-08-26 13:06:58 +02:00
Thomas Arendsen Hein
e78588e43a Make makelock and readlock work on filesystems without symlink support.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Make makelock and readlock work on filesystems without symlink support.
This way you can have a repository on a fat partiton, e.g. a USB stick.

manifest hash: cea2c120ef2b25a50c5d98b59648f773feefe470
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1t5yW7P1GVgWeRoRAsKjAJ9BFcn/EqBK/dmJ4BY1pPIZIbDDJACghN3p
VCQS6CJ72MHpzhOOsnOpHzE=
=laDT
-----END PGP SIGNATURE-----
2005-07-14 22:51:47 +01:00
mpm@selenic.com
0fb5db6915 Whitespace cleanups
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whitespace cleanups

manifest hash: ac954bc3a4f034c12638a259ecd65841f5b63c5c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwuubywK+sNU5EO8RAluIAJ98XQpNdZUpSmYKgDmrMRlbL76ZzQCfes0t
rknNUN/PhtyA4bzL646dOz4=
=UyCE
-----END PGP SIGNATURE-----
2005-06-29 10:42:35 -08:00
mpm@selenic.com
a58fa92f5c Fix troubles with clone and exception handling
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fix troubles with clone and exception handling

Clone deletes its directory on failure

This was deleting the lockfile out from under the lock object before
it got destroyed

This patch shuts lock up and makes the cleanup code for clone a little
cleaner.

manifest hash: f666fddcf6f3a905020a091f5e9fd2cb5d806cdd
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwSGOywK+sNU5EO8RAkx2AKCIxPczl9YWnuUM+bMQnpVr8kv6uQCeNWld
SUxSB99PGJHhq1LWFaSJJNw=
=Frk/
-----END PGP SIGNATURE-----
2005-06-28 02:08:14 -08:00
mpm@selenic.com
e0a4782d31 [PATCH] Enables lock work under the other 'OS'
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[PATCH] Enables lock work under the other 'OS'
From: K Thananchayan <thananck@yahoo.com>

os.symlink is not supported under Windows. This patch
introduces util.mklockf, util.getlowner that use
regular files under Winodws but symlink under unix.

tweaked by mpm:
 - changed function names
 - fixed to work on UNIX

manifest hash: 6f650a78a3b203dcad2f861582500b6b4036599a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCuN5sywK+sNU5EO8RAva8AJ9L9z/JHRAJS1bix48ZzSpn9ZUyPwCffhmg
UfLSFBmd5tPDDi3mgsrdDEA=
=ZYS9
-----END PGP SIGNATURE-----
2005-06-21 19:43:40 -08:00
mpm@selenic.com
0058e326b8 Simply repository locking
This is a first pass at implementing repo locking. Next up, journal
recovery and undo.
2005-05-26 08:53:04 -08:00