I have a mercurial repository with the following directory structure:
/
/system
/applications
/applications/client1
/applications/client2
/applications/client3
I am serving the repo over an apache subdomain over http (no ssl yet) and want to restrict access for push, pull and commit of course. Generally i dont want some users to see the directories at all and also not the history of the directories!
I am lost :(
Since you have everything in 1 repository, then no.
tl;dr: A repository is always complete, and if you can clone it, you can see everything, there is no way to restrict access to content in a local clone, only to a central server-hosted clone.
A Mercurial server can deal with authorization in two ways:
The first type would make the whole repository read-only, or unavailable. However, if a user has read-access, he will be able to clone, and see, the whole repository, history and files alike.
But, you could prevent that same user from modifying the central copy by prohibiting pushes to it. This would mean that that user could do whatever he wanted to with his own private clone, but he would not be able to push those changes back to the central clone.
The other type would allow you to control where changes was allowed to happen a bit more fine-grained. However, note that again, a user will be able to clone, and see, the whole repository.
Additionally, the user will also be able to do whatever he wants to with his own personal clone. However, whereas pushes to the central repository is not totally prohibited with this type of authorization, a hook would look at the changesets being pushed, and if, say, you decide that that user is not allowed to push changes to "client2" content, any such changesets that he tries to push will be aborted.
In other words, the user is able to modify his private clone, including change things in "client2", but if he commits a changeset with "client2" changes, he will not be able to push back to the central repository. He would then have to strip away, or otherwise get rid of those changesets, before his pushes would go through.
So to summarize:
You can use the ACL Extension, which is now distributed with Mercurial by default. The extension can restrict all Hg actions per directory, without resorting to using sub-repositories.
Furthermore, you can restrict access per-branch or per-folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With