subrepositories

Alexander Solovyov piranha at piranha.org.ua
Thu Nov 27 02:17:43 CST 2008


Hi,

I've hacked yesterday small extension, which I called subrepo. [1]

It was inspired by git submodules (and permanent questions about them in
irc channel). There is README file inside repo, which describes it
slightly (though "modes" mentioned there are not supported yet).

Currently there is three commands - sublist, subadd and subupdate.
subupdate updates all/chosen subrepos (cloning and pulling as
necessary).

I was pointed at [2] yesterday in #mercurial, which describes approach
how to do that, but prefers two things: calling them modules (I still
prefer subrepo as it sounds more understanble to me) and storing
information about every subrepo in separate dir:

<piranha> though I don't like dir approach. IMHO file is more 
  natural...
<brendan> it makes it easier on the merge machinery when the urls are
  changed
<piranha> ah...
<piranha> ok, while we're are not far from start, changing is easy
<piranha> I'll stick with file now, but will look
<brendan> yep, play with editing the hgmodules file in different 
  branches and then merging :)

Not sure which way to go.

Currently I'm about to add subdelete and subrecord (which will walk
through subrepos and record if working revision was changed). And
eventually I'd like to add support for git/svn/etc subrepos, but I'm not
sure how to handle them: adding to .hgignore seems natural, but
automation of this process might be hard as it support RE (though I can
go simple way and leave cleanup of .hgignore to user).

Any help is appreciated, particularly comments on code and on
design. Patches... maybe, but please contact me before writing them to
make sure I'm not working on that feature right now (I'm piranha in
#mercurial, and email you can see in headers of this mail ;-).

[1]: http://hg.piranha.org.ua/subrepo/
[2]: http://www.selenic.com/mercurial/wiki/index.cgi/NestedRepositories

-- 
Alexander


More information about the Mercurial-devel mailing list