[darcs-users] darcs-users Digest, Vol 39, Issue 6

Michael Conrad silverdirk at silverdirk.com
Sat Nov 17 22:35:55 UTC 2007


On Wed, 14 Nov 2007 07:00:01 -0500, "Asfand Yar Qazi" <ayqazi at gmail.com>  
wrote:
> On 13/11/2007, Ketil Malde <ketil.malde at bccs.uib.no> wrote:
> > Or you could start with repos containing just 'lib' for each
> > application, and add the application specific stuff to each separate
> > project.
>
> We actually want to forget about 'lib' sharing, and just make a
> 'reference' application that every app we develop has in some way been
> cloned from and had bits added to them.
>  We use Ruby on Rails engines for 'lib', so and defines a file
> containing a class with some methods in it, and the application can
> create a new file of the same name in its own directory, redefine the
> class and effectively add new methods to it or override existing ones.

A bit of a late response, but just in case noone else has replied, here's  
some tips:

It sounds like what you really want is a "set of methods" (or maybe,  
mapping of method name to method implementation, however you like to see  
it)

It *is* possible to do this the way you describe, though won't work too  
well. What you would do, is have a common patch that creates the text file  
and any of its parent directories.  (this means the text file can't be in  
a subdirectory of any directories which were added separately in other  
projects) Then, pull this patch into each repo.  Darcs will now see this  
file as being the same in every repo.  The next step is to structure the  
file in such a way that adding methods to it does't cause conflicts.  This  
is the hard part.  You would have to do something like make comments in  
the file
// a
// b
// c
// d
// e
and then insert your functions in alphabetical order, between the  
comments, hoping that two people don't add a similarly named function  
before seeing eachother's patches.

The better approach is to use one file per function.  Files are arrays of  
text lines and don't behave well when used as sets, but directories are  
naturally sets of files (or mapping from file name to file contents)  So,  
if you set up a common directory for these method-in-a-file, they can be  
pushed and pulled without any trouble, and you will only get a conflict if  
two developers add a method of the same name.  If ruby provides any way  
for you to text-include files into a common file during the make process,  
then you're all set.

-Mike


More information about the darcs-users mailing list