Many Projects/Repositories and common Libraries

Isaac Jurado diptongo at gmail.com
Mon Jan 10 16:52:09 CST 2011


On Mon, Jan 10, 2011 at 8:03 PM, Steven Scott <chowarmaan at gmail.com> wrote:
>        I have a new user question so I try to get the most out of Mercurial
> at the beginning, and not make any bad assumptions/mistakes when
> starting out.  I have a number of projects that I want to place into
> repositories.  As a new user, I have read that it is best to place
> each project into its own repository.  However, I also have a common
> library/API that is used by a number of those projects.

We have a similar scenario at work: different projects sharing code.
In our case, not only library code, but also background service
infrastructure, style sheets and some maintenance scripts.  Right now
the common parts are replicated but next month we will be doing some
refactoring and we will use subrepositories now that the feature is
starting to look mature.

Therefore, the shared code will have its own repository which will be
used as a subrepository of the different projects.

>  I want to use
> the library at a version level and be able to replace/update the
> library in any project at any time.

Depending on how complex your workflow will be, subrepositories may
suit your needs.  Still, you can have different named branches in the
library repository (to be used by different projects) but still have
the chance to merge code between library branches.

Cheers.

-- 
Isaac Jurado

"The noblest pleasure is the joy of understanding"
Leonardo da Vinci


More information about the Mercurial mailing list