How to keep each component from an application in a separate version control repository?
I want to keep each component of an applicat开发者_运维技巧ion in a separate, independant repository, with its own versioning, so they can be distributed separately (eg: you may want to use only one or two components)
Is there a standard way to do this with mercurial or git?
I have seen something like this in symfony2, all the bundles are separate and they get updated from their respective remote repositories with a single command.
And what about nested repositories? Is that possible?
With git you should have a submodule for each component.
Then, from the different applications you want to distribute you just use the correct version from each submodule you need.
This is a very generic question, you can see more about submodules and how you can use them in your setup at: http://book.git-scm.com/5_submodules.html
With Mercurial, you are looking for Subrepos (also see the wiki link).
Each component may be a stand-alone Mercurial repo. These components can then be nested inside a "parent" repo as a subrepo.
The parent repo points to a specific revision of each subrepo, so different projects may use different versions.
精彩评论