[darcs-users] Including another repos in a subdirectory

David Roundy droundy at abridgegame.org
Mon Jul 19 10:36:18 UTC 2004

On Sun, Jul 18, 2004 at 07:12:12PM +0200, Lele Gaifax wrote:
> using darcs for several projects based on collections of various free
> software pieces, I'm facing a new problem: "absorbing" an external
> product from its own darcs repository.  

My general thought is that it is better not to require that the source of
other (generally library) projects be contained within one's own source
directory.  My feeling is that libraries should be kept as separate as
possible from their use, with a separate build and "make install".

On the other hand, that may not always be possible, and certainly it isn't
a "darcs" issue.  It does explain why darcs doesn't have better builtin
support for this kind of business.

> The problem raises from the fact that that project keeps most of its
> sources in the root directory of the repository, while I would need it
> placed in some subdirectory in my repository tree. When the upstream
> repository is under CVS or SVN I have total control on where I extract
> it and then "darcs add" to my repos, but if on the other side there's
> darcs, this is ironically a little bit more complicated.
> Given excellent darcs mv behaviour, I could of course just go and
> "darcs mv" everything in the right place, but I imagine this fails
> when new files were added by the upstream author.

There is also a problem here if the upstream has a file with the same name
as one in your root directory (e.g. Makefile or README).  This is
alleviated if you don't keep much in your root directory, which I guess
you might want to do anyways.

Interestingly, it's only a problem if the *initial* names of the two files
are the same, so you could create your makefile as
Makefile.my_own_projects_makefile and then rename it to Makefile, and you'd
have no trouble.  The reason being that you'd have broken the symmetry,
since it would be a rename "conflicting" with an add, so all would be
fine (darcs would just rename one of the two files with some sort of an

> I will suggests an upstream tree re-layout: having the project kept
> under a common "/ProductName/" tree would make everything work
> smooth...  but in general, isn't it possible to "redirect" in some way
> incoming patches down to a sub directory?

I've thought about the idea of giving the "." (root) directory a name.
Then one could mv the root directory around.  Currently a file in the root
directory is (to darcs) ./file, but the ./ is always required.  If we
replaced "." with a different name, then each repository could have its own
root directory name, and if you pull from another root directory... we'd
have to figure out what would happen.  I'm not sure this would be a good
idea, and it could complicate the code all over the place, since it would
mean that the "darcs file path" wouldn't be a valid file path in the
working directory.

What I would really recommend, would be to not have the upstream in your
darcs repository at all.  You could instead have it in its own darcs
repository, in a subdirectory of your repository (assuming you want it
there).  Of course, this will only work if the two projects aren't very
closely linked, since changes in one won't include changes in the other.
It also will mean that multiple "darcs get" command will be needed to get a
copy of all the projects, and multiple "darcs pull"s will be needed to
bring a directory up to date, but those could be scripted, or otherwise
dealt with.  And you'd benefit in that darcs works more efficiently on
smaller repositories.
David Roundy

More information about the darcs-users mailing list