I got some Mercurial repositories which are served by Apache over HTTP. But there is a dedicated user performing some automated tests, which needs to check out the repositories locally. Recently this started to fail, seemingly due to lacking rights for files in the largefiles subdirectory in .hg:-rw------- 2 www-data www-data 6.3M 2012-01-02 17:23 9358b828fb64feb37d3599a8735320687fa8a3b2Default umask should be 022. And I used the setgid settings for the directories in .hg according to the multiple committers wiki page, which does not cover .hg/largefiles though. However, as far as I understand it, setting the gid for this directory wouldn't solve the problem, that hg sets such restrictive rights on those files. My other user trying to access this repositories via the filesystem is also in the www-data group, thus an additional read right for group would be sufficient to solve my problem.How can I convince Mercurial, or the system to grant this right properly for new files?I am using: Mercurial Distributed SCM (version 2.1)
How to change file permissions for newly generated files in largefiles directory of Mercurial?
permissions;version control;mercurial
It turns out that this is a problem in Mercurial and that there isn't an easy work-around for Mercurial 2.1. I've just sent three patches to the Mercurial mailinglist to fix this  hopefully you'll see the fix in Mercurial 2.1.1 in a week.The problem is that the largefiles extension is creating the .hg/largefiles/<hash> files by writing data into a temporary file which is then later renamed to the real name. It creates its temporary files using the standard tempfile module in Python. The module restricts the permissions to 600 since you normally don't want anybody to read your temporary files. The largefiles extension didn't take this into account and just renamed the file.My patches fix this by taking the permissions of .hg/store into account when creating the temporary files. This should bring largefiles into line with the rest of Mercurial.