VC++ 的 Mercurial 存储库结构目录

发布于 2024-10-07 07:34:44 字数 1863 浏览 3 评论 0原文

我正在将旧的 C/C++ 代码库迁移到 Mercurial。 我有点不清楚存储库结构的最佳(或至少接近最佳)应该是什么样子,因为我找到的示例适用于 .NET 或 Java。我的问题主要是处理VC++ 目录,早在我之前我们就已经经常使用它了。

currently, on disk:
\DEV
    \include
    \source
    \lib
        \static-link1.lib
        \static-link2.lib
        \static-link3.lib
        ...
    \projects
        \projA
        \projB
        \projC
        ...
        \lib1-src
        \lib2-src
        \lib3-src
        ...

以下是我认为我们无需做太多思考就能做到的方式,但我可以预见在链接过程中会出现一些版本控制/依赖性问题(链接到旧的 .lib)。在此示例中,\source\include\static-libs 在检查时将是旧的全局 VC++ 目录出去。

mercurial (alternative #1):
\repo: include
\repo: source
\repo: lib1-src
\repo: lib2-src
\repo: lib3-src
...

\repo: static-libs
    \static-link1.lib
    \static-link2.lib
    \static-link3.lib
    ...

\repo: projA-prod
\repo: projA-dev
\repo: projB-prod
\repo: projB-dev
\repo: projC-prod
\repo: projC-dev
...

进入替代方案#2。这样会更好吗?如果我唯一想做的就是使用新版本的库对某个项目进行新的生产构建,我可以进入子存储库并仅对子存储库进行拉取/更新/合并吗?这种替代方案实际上删除了全局 \lib 目录,并将其改为每个项目,这有望使其更加灵活。另一方面,签入已编译的库会感觉非常错误。

mercurial (alternative #2):
\repo: include
\repo: source
\repo: static-libs (only for subrepos)

\repo: projA-prod
    \subrepo: static-libs
\repo: projA-dev
    \subrepo: static-libs

\repo: projB-prod
    \subrepo: static-libs
\repo: projB-dev
    \subrepo: static-libs

\repo: projC-prod
    \subrepo: static-libs
\repo: projC-dev
    \subrepo: static-libs
...

\repo: lib1-src
\repo: lib2-src
\repo: lib3-src
...

还有其他想法吗?你怎么做?过去 4 年主要使用 .NET,我不再那么喜欢这些全局 \source / \include 文件夹,但我不知道如何我们可以完全摆脱它们。绝对应该可以稍微削减源代码或将一些代码移动到库中,从而最大限度地减少这些 .h/.cpp 文件中的项目间依赖关系,但仍然需要存在一些简单的代码重用。

附加问题:我可以看到 \include\source 甚至位于同一存储库中,因为它们几乎意味着处于锁定步骤,​​这就是你的做法它?

I'm in the process of moving our old C/C++ codebase to Mercurial.
I'm a bit unclear as to how the repository structure optimally (or at least near optimally) should look like, since the examples I've found are for .NET or Java. My problem is mostly about dealing with the VC++ Directories, which we've been using a lot since way before my time.

currently, on disk:
\DEV
    \include
    \source
    \lib
        \static-link1.lib
        \static-link2.lib
        \static-link3.lib
        ...
    \projects
        \projA
        \projB
        \projC
        ...
        \lib1-src
        \lib2-src
        \lib3-src
        ...

Here's how I could see we would do it without doing much of any thinking, but I can foresee some versioning/dependency problems cropping up during linking (linking to an old .lib). \source, \include and \static-libs would in this example be the old global VC++ Directories when checked out.

mercurial (alternative #1):
\repo: include
\repo: source
\repo: lib1-src
\repo: lib2-src
\repo: lib3-src
...

\repo: static-libs
    \static-link1.lib
    \static-link2.lib
    \static-link3.lib
    ...

\repo: projA-prod
\repo: projA-dev
\repo: projB-prod
\repo: projB-dev
\repo: projC-prod
\repo: projC-dev
...

Onto alternative #2. Would this be better? Could I go into a subrepo and do a pull/update/merge on just the subrepo if the only thing I would want to do is to do a new production build of a certain project with just a new version of a lib? This alternative practically removes the global \lib directory and makes it per-project instead, which makes it a bit more flexible, hopefully. On the other hand it would feel pretty wrong to check in compiled libs.

mercurial (alternative #2):
\repo: include
\repo: source
\repo: static-libs (only for subrepos)

\repo: projA-prod
    \subrepo: static-libs
\repo: projA-dev
    \subrepo: static-libs

\repo: projB-prod
    \subrepo: static-libs
\repo: projB-dev
    \subrepo: static-libs

\repo: projC-prod
    \subrepo: static-libs
\repo: projC-dev
    \subrepo: static-libs
...

\repo: lib1-src
\repo: lib2-src
\repo: lib3-src
...

Any other ideas? How do you do it? Having worked mostly with .NET for the past 4 years, I'm not that fond of these global \source / \include folders anymore, but I don't see how we can get rid of them completely. It should definitely be possible to cut the source up a bit or move some code to libs, thus minimising inter-project dependencies in those .h/.cpp files, but some simple code reuse will still need to exist.

Additional question: I could see \include and \source even be in the SAME repository, since they are pretty much meant to be in lock-step, is that how you do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文