[PATCH] umask for multiple commiters

Thomas Arendsen Hein thomas at intevation.de
Sun Oct 15 17:55:04 UTC 2006


* 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

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?

This way the umask setting is not _that_ general.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/



More information about the Mercurial-devel mailing list