[PATCH] umask for multiple commiters

Aurelien Jacobs aurel at gnuage.org
Mon Oct 16 21:38:49 UTC 2006


On Sun, 15 Oct 2006 19:55:04 +0200
Thomas Arendsen Hein <thomas at intevation.de> wrote:

> * Aurelien Jacobs <aurel at gnuage.org> [20061015 17:27]:
> > On Fri, 13 Oct 2006 18:51:31 +0200
> > Thomas Arendsen Hein <thomas at intevation.de> wrote:
> > 
> > > * Aurelien Jacobs <aurel at gnuage.org> [20061013 01:11]:
> > > > Some times ago, there was a disscussion about setting umask in mercurial:
> > > > http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/4532
> > > > There was no conclusion to this thread :-(
> > > > 
> > > > Now I'm setting up a repo with multiple commiters using SGID, so I need
> > > > umask to be set to 002 so that new files are created group writable.
> > > > 
> > > > Attached is an updated version of the patch sent in the original thread.
> > > > I think it's the best and simplest solution.
> > > 
> > > Shouldn't the umask setting apply to all things written by hg then,
> > > not only hg serve --stdio?
> > 
> > I personnaly only need it for server mode, but indeed, it could be
> > useful more globally.
> > 
> > > In this case putting it in the [web] or [server] section isn't good.
> > > Maybe we need something like the [ui] section for all non-ui-related
> > > stuff, as currently the number of sections with only one setting
> > > isn't nice. Maybe [settings] or [general]?
> > 
> > Agree. Attached is a new patch which use [general] and set the umask
> > globally.
> 
> > diff -r ba7c74081861 -r d7b34f382a40 mercurial/commands.py
> > --- a/mercurial/commands.py	Fri Oct 13 17:58:04 2006 -0500
> > +++ b/mercurial/commands.py	Sun Oct 15 17:27:55 2006 +0200
> > @@ -3303,6 +3303,10 @@ def dispatch(args):
> >      load_extensions(u)
> >      u.addreadhook(load_extensions)
> >  
> > +    umask = u.config("general","umask")
> > +    if umask:
> > +        os.umask(int(umask))
> > +
> 
> This wouldn't allow for umask changes using the repositories .hg/hgrc

Right.

> Additionally corecode had a nice idea in IRC: what about inheriting
> the permissions of the .hg directory or always the parent directory
> (if below .hg) when creating files/directories?

Indeed, the idea is pretty good. It perfectly fits my use case, without
needing any specific config option. Great.

The attached patch try to implement the idea. It seems to work nicely
(tested with localrepo and sshrepo). But I'm still discovering Mercurial
internals, so someone should double-check the patch.

Thanks,
Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inherit-mode.diff
Type: text/x-diff
Size: 3135 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20061016/0fd5ef3e/attachment.diff>


More information about the Mercurial-devel mailing list