Mercurial:如何管理公共/共享代码

时间:2021-10-14 21:02:27

I'm using Mercurial for personal use and am conteplating it for some distributed projects as an alternative to SVN for various reasons.

我正在使用Mercurial供个人使用,并且因为各种原因而将其作为SVN的替代品用于某些分布式项目。

I'm getting comfortable with using it for self contained projects and can see various options for sharing however I haven't yet found any guidance on managing common libraries to be included in multiple projects in a similar manner to that provided by externals in subversion.

我对将它用于自包含项目感到满意,并且可以看到各种共享选项,但是我还没有找到任何关于管理公共库的指导,这些库将以与subversion中的外部组件类似的方式包含在多个项目中。

The most obvious shared lump of code is error handling and reporting - we want this to be pretty much the same in all projects (its fairly well evolved). There is also utility code, control libraries and similar that we find better to have as projects built with each solution than to pull in as compiled classes (not least because it ensures they are kept up to date, continuous integration helps us address breaking changes).

最明显的共享代码块是错误处理和报告 - 我们希望这在所有项目中都是相同的(它已经很好地发展)。还有实用程序代码,控制库和类似物,我们发现使用每个解决方案构建的项目比作为编译类引入更好(尤其是因为它确保它们保持最新,持续集成有助于我们解决重大变化) 。

Thoughts (I hate open ended questions, but I want to know what, if anything, others are doing).

思考(我讨厌开放式问题,但我想知道其他人在做什么,如果有的话)。

4 个解决方案

#1


Mercurial 1.3 now includes nested repository support, which can be used to express dependencies. The other option is to let your build system handle the download and tracking of dependencies using something like ivy or maven though those are more focused on pulling down compiled code.

Mercurial 1.3现在包含嵌套存储库支持,可用于表示依赖关系。另一个选择是让你的构建系统使用像常春藤或maven这样的东西来处理依赖项的下载和跟踪,尽管那些更专注于下拉编译代码。

#2


The world has changed since I asked that question and the solution I now use is different.

自从我提出这个问题后,世界发生了变化,我现在使用的解决方案也有所不同。

The simple answer is now to use packages (specifically NuGet as I do .NET) to deliver the common code instead of nesting repos and including the projects in a solution.

现在简单的答案是使用包(特别是NuGet,就像我做.NET)来提供公共代码而不是嵌套repos并将项目包含在解决方案中。

So I have common code built into NuGet packages by and hosted using TeamCity and where previously I would have an external and include the project/source I would now just reference the package.

所以我有一些内置在NuGet包中的公共代码,并使用TeamCity进行托管,之前我将拥有一个外部包含项目/源代码,我现在只需引用该包。

#3


Use the Forest Extension it emulates svn externals for HG, to some extent that is.

在某种程度上,使用它为HG模拟svn外部的Forest Extension。

#4


Subrepository (with good guide) or Guestrepo "to overcome ... limitations" (of subrepos) is today's language-agnostic answer

Subrepository(有很好的指导)或Guestrepo“克服......限制”(subrepos)是今天语言无关的答案

#1


Mercurial 1.3 now includes nested repository support, which can be used to express dependencies. The other option is to let your build system handle the download and tracking of dependencies using something like ivy or maven though those are more focused on pulling down compiled code.

Mercurial 1.3现在包含嵌套存储库支持,可用于表示依赖关系。另一个选择是让你的构建系统使用像常春藤或maven这样的东西来处理依赖项的下载和跟踪,尽管那些更专注于下拉编译代码。

#2


The world has changed since I asked that question and the solution I now use is different.

自从我提出这个问题后,世界发生了变化,我现在使用的解决方案也有所不同。

The simple answer is now to use packages (specifically NuGet as I do .NET) to deliver the common code instead of nesting repos and including the projects in a solution.

现在简单的答案是使用包(特别是NuGet,就像我做.NET)来提供公共代码而不是嵌套repos并将项目包含在解决方案中。

So I have common code built into NuGet packages by and hosted using TeamCity and where previously I would have an external and include the project/source I would now just reference the package.

所以我有一些内置在NuGet包中的公共代码,并使用TeamCity进行托管,之前我将拥有一个外部包含项目/源代码,我现在只需引用该包。

#3


Use the Forest Extension it emulates svn externals for HG, to some extent that is.

在某种程度上,使用它为HG模拟svn外部的Forest Extension。

#4


Subrepository (with good guide) or Guestrepo "to overcome ... limitations" (of subrepos) is today's language-agnostic answer

Subrepository(有很好的指导)或Guestrepo“克服......限制”(subrepos)是今天语言无关的答案