Distributed SCM and branching a sub-directory ?

June 4th, 2007 by lucas

I am considering switching from SVN to a distributed SCM for my personal stuff. I had a look at git and mercurial, but neither really support branching a sub-directory:

Often, I am working on a big private project, and, while working on a sub-project (stored inside the project’s repository), I’d like to share that sub-project with others. So there are actually two problems:

  • being able to checkout/branch/clone a sub-directory
  • possibility to control access on a per-directory basis

SVN only partially meets my needs with that (it’s possible to checkout a sub-directory directly, for example with svn co svn://svn.debian.org/svn/pkg-ruby-extras/tools/ruby-pkg-tools). I think that it’s possible to do fine-grained access control
using libapache2-svn, but I haven’t tried yet.

It seems that mercurial can do that, using the forest extension. But you have to convert the specific directory into a repository, with a complex step to keep the history.

Amongst the distributed SCM, is there one that supports that ? (at least the sub-directory branching part)

8 Responses to “Distributed SCM and branching a sub-directory ?”

  1. martin wrote on 06/5/07 at 12:02 am :

    I think with “changeset” based systems really branching off subdirectories is hard. you would need to split the changeset if it has changes inside and outside. And normal distributed scms a) use immutable changesets, b) copy all changesets for the relevant timespan on cloneing/checkout/….
    So keeping parts of the tree private in distributed scms is not easy to get.

  2. rick wrote on 06/5/07 at 12:16 am :

    I think that it’s possible to do fine-grained access control
    using libapache2-svn, but I haven’t tried yet.

    Indeed it is, but it causes problems with add-ons :(

    I use authz, which works fine for svn:// access, giving you directory level access control via svn commands, or web access.

    However, many(most?) of the web front ends (websvn, viewvc) subterfuge things such that authz access control is bypassed :(

    trac, however works fine !

  3. Sandy wrote on 06/5/07 at 12:20 am :

    For SVN at least, with mod_authz_svn you can pretty easily set up path-based permissions in a little authz file.

    Check out:
    http://davidwinter.me.uk/articles/2006/03/03/access-control-for-subversion-with-apache2-and-authz/

    Don’t know about distributed stuff.

  4. Anonymous wrote on 06/5/07 at 12:33 am :

    Git’s new “submodule” support would let you have the same type of structure as hg’s forest extension. You could use git-split to split out the history of a submodule, and with some minor enhancements to git-split, it could also rewrite the history of the rest of the repo to reference the submodule.

  5. bartman wrote on 06/5/07 at 1:35 am :

    If you wait another two months git should support all the things you need.

    http://git.or.cz/gitwiki/SubprojectSupport?highlight=%28subproject%29

  6. ptman wrote on 06/5/07 at 7:29 am :

    SVK can probably do that today. Check it out at http://svk.bestpractical.com/view/HomePage . I would really recommend to use git instead though, if it is in any way acceptable

  7. noplay wrote on 06/5/07 at 9:22 am :

    For controll access on directory i just publish a web interface who generate the subversion configuration files.

    http://www.usvn.info

  8. Hezekiah wrote on 06/5/07 at 4:43 pm :

    I would second SVK, particularly if you are already using Subversion. It really is a very nice tool.