[PATCH] umask for multiple commiters
Aurelien Jacobs
aurel at gnuage.org
Sun Oct 15 10:28:56 CDT 2006
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.
Aurel
-------------- next part --------------
# HG changeset patch
# User Aurelien Jacobs <aurel at gnuage.org>
# Date 1160926075 -7200
# Node ID d7b34f382a4056ed160c75ae5fd9c6780a50661a
# Parent ba7c74081861790e04ab2be4031c11ebaaf6cde6
allow to specify a umask in the config applying to all files created by hg
diff -r ba7c74081861 -r d7b34f382a40 doc/hgrc.5.txt
--- a/doc/hgrc.5.txt Fri Oct 13 17:58:04 2006 -0500
+++ b/doc/hgrc.5.txt Sun Oct 15 17:27:55 2006 +0200
@@ -195,6 +195,11 @@ extensions::
hgext.mq =
# (this extension will get loaded from the file specified)
myfeature = ~/.hgext/myfeature.py
+
+general::
+ Settings which apply globally to all commands.
+ umask;;
+ umask used for files created by Mercurial.
hooks::
Commands or Python functions that get automatically executed by
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))
+
try:
cmd, func, args, options, cmdoptions = parse(u, args)
if options["time"]:
More information about the Mercurial-devel
mailing list