Colloborating via NFS vs. umask
Georg Sauthoff
g_sauthoff at web.de
Tue Dec 18 08:37:57 CST 2007
Bryan O'Sullivan <bos at serpentine.com> wrote:
> Georg Sauthoff wrote:
>> How do you work in NFS-based environments with mercurial?
> Don't. Use HTTP or ssh instead. NFS gives terrible performance, and
> its file locking and caching semantics are not trustworthy. (Maybe they
> are in principle, but in practice it's never been hard to find different
> operating systems with interop bugs.) Just don't go there.
ok - I have to look into the http-setup then. But I fear that the
user management is a bit complicated (because we don't have
kerberos available, and the co-devs don't appreciate to learn new
passwords etc.).
Is it possible to directly clone a local repository to
http-destination (if the user has enough priveleges)?
Btw, yesterday I hacked a umask extension for Mercurial ;).
Basically you can specify via
[umask]
umask = 007
a specific umask for mercurial, or if this is not present,
mercurial chooses a umask depending on the permissions of the
parent directory.
# cat umask.py
import mercurial.repo
import mercurial.hg
import os
import os.path
from stat import *
_umask = os.umask(0)
os.umask(_umask)
def umask_from_parent(p):
s = os.path.split(p)
r = os.stat(os.path.normpath(s[0]))
mode = r[ST_MODE] & (S_IRWXU | S_IRWXG | S_IRWXO)
new_umask = mode ^ 0777
os.umask(new_umask)
def localpath(path):
if path.startswith('file://'):
return path[7:]
if path.startswith('file:'):
return path[5:]
return path
def my_clone(ui, source, dest=None, pull=False, rev=None, update=True,
stream=False):
mask = ui.config('umask', 'umask')
if mask == None:
d = localpath(dest)
d = os.path.normpath(d)
try:
umask_from_parent(d)
except:
ui.debug('umask: non-local destination. Doing nothing.')
else:
os.umask(int('0'+mask))
orig_clone(ui, source, dest, pull, rev, update, stream)
orig_clone = mercurial.hg.clone
mercurial.hg.clone = my_clone
def reposetup(ui, repo):
ui.debug('umask: repo.url(): %s' % repo.url())
if not repo.local():
return
mask = ui.config('umask', 'umask')
if mask == None:
p = repo.url()[5:]
umask_from_parent(p)
else:
os.umask(int('0'+mask))
Best regards
Georg Sauthoff
--
Jabber : gsauthof at jabber.ccc.de
Fortune : 'Real programmers don't comment their code.
It was hard to write, it should be hard to understand.' ;)
More information about the Mercurial
mailing list