简体   繁体   中英

what is the best practice for external repos in hg?

Similar, but the answer is discouraged by hg docs: Can I emulate svn:externals using mercurial?

Prior to using hg I was using Subversion. It seems like the externals in Subversion are quite strong: I can have sub-repo that is pointing to a specific version of another repo. But the docs for Subrepository in Hg say it is a 'Feature of Last Resort'. Wow that's ominous. Plus I don't see anything in the docs about sticking that subrepo to a specific version.

Deps extension is no longer maintained.

Forest extension is discouraged on the site.

So if I want version XYZAB of a repo to be nested inside my Hg repo, what's the best alternative right now that isn't a Feature of Last Resort? Is Hg just kinda bad at this feature?

Guestrepo is worth looking at, but very new at this point: https://bitbucket.org/selinc/guestrepo

But the docs for Subrepository in Hg say it is a 'Feature of Last Resort'. Wow that's ominous.

This means that you should double-check that you really need subrepos. There are many very large project that use Mercurial without using subrepositories. They manage their code as a collection of loosely-coupled repositories instead — the main problem with subrepositories is that they create a very tight coupling and tightly coupled components are normally avoided in software design since they restrict your flexibility.

However, support for subrepositories wont go away, infact it will gradually improve over time as people present good use cases to us.

Plus I don't see anything in the docs about sticking that subrepo to a specific version.

Strange, since subrepositories are all about checking out a specific version. That is, you can only checkout the exact same version that you committed. The version is written to .hgsubstate when you commit and hg update will consult that file on checkout.

Please see the Mercurial Kick Start guide and hg help subrepos for info about how the .hgsubstate file is treated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM