Subrepositories

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Aug 31 15:56:48 UTC 2016


> On Aug 31, 2016, at 10:10, Nicolas Pinault <nicolasp at aaton.com> wrote:
> 
> Le 31/08/2016 à 16:57, Kevin Bullock a écrit :
>>> On Aug 31, 2016, at 02:28, Nicolas Pinault <nicolasp at aaton.com>
>>>  wrote:
>>> 
>>> Hi,
>>> 
>>> I'm starting to use subrepositories.
>>> My first question : Do I have to add .hgsubstate to the repository ?
>>> 
>> No, you just create the .hgsub file and Mercurial maintains the .hgsubstate for you.
>> 
>> What are you using them for? Subrepos are generally considered a feature of last resort—a feature that is fully supported, but has significant tradeoffs in its use vs. normal Mercurial usage. You'll want to read the recommendations and caveats on the wiki: 
>> <https://www.mercurial-scm.org/wiki/Subrepository#Recommendations>
> I hoped the answer is "yes". 
> I'm quite sure TortoiseHg adds it automatically. If it is not in the main repo, I don't understand how hg knows which revision of the sub-repos have to be used when pulling/updating.
> 
> I use big libraries (boost and others) in my project. I don't want these libraries to be added to my main repo. So I decided to use  sub-repositories.

That is a classic use case where people want to reach for subrepos (or svn externals or other equivalent features). But it's almost always the wrong solution. Fetching and maintaining dependencies is a problem that's much better solved by your build system and your operating system. I think CMake is commonly used for this purpose in C++ projects. There's also Boost Build: <http://www.boost.org/build/>

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock




More information about the Mercurial mailing list