Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96448

Default permissions when Mercurial creates files

If Mercurial does not track file permissions by default, how does it decide on the permissions for any files/directories it creates?

Does it use umask? If not, what does it use?

I have read in the mail list the following:

Mercurial uses the mode of the .hg/store directory to compute a mask

but this seems a bit arbitrary (if there is any explanation behind it, I'd love to hear it). Is this explained in the documentation?

Upvotes: 6

Views: 806

Answers (1)

VonC
VonC

Reputation: 1329292

There doesn't seem to be any complete explanation, only a mention of it in the "How To Handle Multiple Committers" page:

If you are using a version of Mercurial older than 1.0, it's important that each user's umask be set to 002 or something similar. If it's set to 022, group write privileges will be masked off for files that users create, causing other users to be unable to modify them.

You can change the default umask for a user by editing their ~/.profile and adding the line...

umask 002

Alternatively, you can edit /etc/profile to change the system-wide settings.
Changing the /etc/profile will not work if people check in stuff with the hg command, as that file isn't read by non-interactive shells, /etc/bash.bashrc is a better place to put the system-wide settings.

Otherwise since Mercurial 1.0, the default permission is inherited from .hg/store.

Upvotes: 3

Related Questions