Ownership question

Martin Geisler mg at daimi.au.dk
Sun Feb 22 08:07:22 CST 2009


yosmc <stefan at creativitypool.com> writes:

> I'm new to Mercurial and I'm having trouble with file ownership after
> running "hg clone". I've also searched the Net throughly but since I
> could find this topic addressed anywhere, I have reason to believe
> that I must be doing something substantially wrong. ;)

Mercurial simply doesn't track ownership of files.

It wouldn't work in any sane way: when I as user "mg" commit a file to
my local clone, push it to bitbucket.org, and then checkout the file on
another computer as user "mgeisler", then I cannot create a file owned
by "mg". (Normal users cannot change ownership of files in Linux)

In your case it seems that you want to deploy your website with
Mercurial -- no problem, I do this myself on http://viff.dk/. It works
like this:

* I (as user "mg") edit the files in my local clone of the website

* I push it with SSH to ssh://viff@viff.dk/repos/viff.dk. This means
  that the user "viff" on the webserver stores the new changesets in the
  repository at ~viff/repos/viff.dk.

* I have a hook in ~viff/repos/viff.dk/.hg/hgrc which updates the
  repository (otherwise the files wont change, we would only be adding
  new history) and rebuilds the HTML files:

  [hooks]
  changegroup.build = hg update && ./buildhtml.py

* The ~viff/repos/viff.dk repository is served with Apache.

So the files are owned by me on my computer and on the webserver they
are owned by the correct user -- no permission problems at all.

The important point is that you don't want your developers to be messing
around with the files on the server, instead they should edit them in
their local clones. When they are happy with a fix, they will push to
the server and at that point the ownership will change as needed.

This also means that you probably don't want the files lying around
owned by "root" on the server, instead use an unpriviledged user, the
webserver typically only needs to read the files.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20090222/affccf97/attachment.pgp 


More information about the Mercurial mailing list