Establishing ownership of a file using Mercury

I use mercurial as part of my workflow process and it works well. However, I have one problem with nitpicking. When I pop out of my central repository to my Linux web server to do an update, I do this with the "root" user. It seems that the owner and group assign "root" to any new or changed files.

Unfortunately, I encounter other difficulties with this, so I always need to go through and reset all the files for the corresponding group and owner (non-root user on the web server).

Is there a way to get mercurial to do this automatically, or does someone have a quick way to do this? I use a shell and must type

chown -R username /home/username

I am trying to do something similar with chgrp. It all seems messy, and I suspect there is an easier way to accomplish what I need. Is there a way to set the owner and group when pulling from the repository?

+3
source share
2 answers

You have to pull, if not root, and then you will not have this problem. However, if this is not possible for any reason, you can always use the update binding to fix file permissions. In the repository file .hg/hgrcyou should put:

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

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

+8
source

,

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

Source: https://habr.com/ru/post/1772877/


All Articles