inherit mode patch

Matt Mackall mpm at selenic.com
Sun Mar 4 11:57:20 CST 2007


On Sun, Mar 04, 2007 at 01:12:23PM -0300, Alexis S. L. Carvalho wrote:
> Thus spake Alexis S. L. Carvalho:
> > I was thinking of (finally) pushing some version of Aurelian Jacobs's
> > patch to make new files under .hg inherit the permissions from the .hg
> > directory itself - specifically the version below[1], slightly updated
> > to take advantadge of the fact that we now cache the value of umask in
> > util.py
> 
> Below is a patch that actually applies and (I think) works.  There's
> still a small issue that the .hg/store/{journal,undo} files created by
> the transaction system still follow the umask, but that can be solved
> later.
> 
> Hmm...  I guess I'll have to fix the directory creation for symlinks
> that I pushed earlier today, too...
> 
> Alexis
> 
> 
> diff -r 26596a6b6518 -r 0f320bf33473 mercurial/localrepo.py
> --- a/mercurial/localrepo.py	Fri Feb 23 17:54:34 2007 +0200
> +++ b/mercurial/localrepo.py	Thu Nov 02 00:17:16 2006 +0100
> @@ -33,7 +33,7 @@ class localrepository(repo.repository):
>          self.path = os.path.join(path, ".hg")
>          self.root = os.path.realpath(path)
>          self.origroot = path
> -        self.opener = util.opener(self.path)
> +        self.opener = util.opener(self.path, inheritmode=True)

Wouldn't it be simpler to just pass mode=x down and be done with it?
Where mode=None if umask is agreeable? Then opener can simply do:

  if mode:
    chmod(f)

I'd really like to avoid making opener any more complicated than it
already is.

I don't see any useful reason to have just subsets of a repo being
group-writable. That'll just cause more confusion. So it should really
be an all or nothing thing based on the permissions of .hg.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list