开发者

setting file ownership with mercurial

I am using mercurial as part of my workflow process and it is working well. I have one niggling problem though. When I pull from my central repository down to my Linux web server in order to make an upgrade, I'm doin开发者_开发百科g it with the "root" user. That appears to assign the owner and group to "root" for any files that are new or changed.

Unfortunately I run into other difficulties with that, so I'm always having to go through and reset all the files to the proper group and owner (a non-root user on the web server).

Is there some way to get mercurial to do this automatically, or does someone have a fast way of doing it? I am using the shell and having to type

chown -R username /home/username

I try to do something similar with chgrp. The whole thing seems messy, and I suspect there's a simpler way to accomplish what I need. Is there a way to set owner and group when pulling from a repository?


You should be pulling as you not as root and then you wouldn't have that problem. However, if that's infeasible for some reason you can always use an update hook to correct file permissions. In your repository's .hg/hgrc file you'd put:

[hooks]
update = chown -R username:usergroup /home/username

And that command will be automatically run after each hg update (or hg pull -u).


You can add multiple hooks by defining each one separately

    [hooks]
    update.command1 = chown -R username:usergroup /home/username
    update.command2 = chown username2:usergroup2 /home/username/excludeme
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜