Breaking hard links between repositories
Guido Ostkamp
hg at ostkamp.fastmail.fm
Tue May 27 14:07:33 CDT 2008
On Tue, 27 May 2008, Matt Cross wrote:
> Is there some file in the repository that will not be hard linked that
> we can manage the permissions on to prevent pushing?
I the Bryan O'Sullivan's Mercurial book, section 4.5.3 "Concurrent
access", I found this:
"Mercurial uses locks to ensure that only one process can write to a
repository at a time (the locking mechanism is safe even over filesystems
that are notoriously hostile to locking, such as NFS). If a repository is
locked, a writer will wait for a while to retry if the repository becomes
unlocked, but if the repository remains locked for too long, the process
attempting to write will time out after a while. This means that your
daily automated scripts won't get stuck forever and pile up if a system
crashes unnoticed, for example. (Yes, the timeout is configurable, from
zero to infinity.)"
In the code it appears symlinks are used to implement those locks. You
need to find out where you need to create symlinks to prevent writing to
the repo. A negative effect would be that if the repo remains locked, all
applications trying to access the repo get stuck and wait for a timeout.
Also I think it would certainly be possible for you to tweak Mercurial
code in order to check e.g. presence of write permission for the target
repo base directory before continuing with the rest of the 'push' code.
RTSL ;-)
Regards
Guido
More information about the Mercurial
mailing list