在 hg 存储库之间以托管方式共享文件

发布于 2024-09-28 20:11:40 字数 723 浏览 2 评论 0原文

问题:一个 hg 存储库有一个我想要更新的文件&维护在另一个 hg 存储库中,我不想复制 &粘贴。我确实希望该文件在两个存储库中都可用。

场景:

开发产品 0001

项目 A 有一个 hg 存储库。

接下来,B 项目启动了。基本上没有耦合 项目 A 和 B 之间,但是有一些文件可以 共享。

托管方法中的版本控制文件至关重要:复制和复制 粘贴不是一个可行的解决方案。

有一些可行的解决方案 -

  • 将两个存储库合并到一个产品存储库。但是,这意味着一组文件的版本号将由于其他地方的变动而发生变化。另外,不同的项目并没有太大的相关性。
  • 将两者都转换为子存储库。我不确定这是否是正确的方法,子存储库似乎有一些与父存储库相关的奇怪行为。 (或者他们曾经这样做过?)

扩展这个问题是在产品之间共享某些文件的概念。不知何故,文件需要作为单个文件进行共享和正确跟踪,但在两个不同的产品中。

一般问题可以表述为:

给定一组产品,每个产品都有自己的存储库,正在开发中,这些产品共享和开发彼此存储库中的文件(想想实用程序和框架),那么在产品之间保持文件版本一致的 hg 解决方案是什么。

这里有什么好的解决方案?

Problem: One hg repository has a file I want to update & maintain in another hg repository, and I do not want to copy & paste. I do want to have the file available in both repos.

Scenario:

Working on Product 0001

Project A has an hg repository.

Down the road, a Project B is spun up. There is largely no coupling
between Project A and B, but there are some files that could be
shared.

Version controlling files in a managed approach is critical: copy &
pasting is not a viable solution.

There are some solutions that may work -

  • Merging both repos into a product repo. But, this means the version numbers for a set of files will be changing due to churn elsewhere. Plus, the different projects aren't terribly related.
  • Convert both into a subrepo. I am not sure this is the right approach, subrepos seem to have some funky behavior relating with the parent repo. (Or they used to?)

Extending this issue is the concept of sharing certain files between Products. Somehow, a file needs to be shared and correctly tracked as being a singular file, but in two different Products.

The general problem might be stated as this -

Given a set of products, each with their own repository, under development which share and develop upon files living in each other's repositories (think utility routines and frameworks), what is the hg solution to maintaining file-version consistently between products.

What is a good solution here?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桃扇骨 2024-10-05 20:11:40

您的第二个电话是正确的。您应该提取两个存储库中的文件并将其设为第三个存储库,然后为项目 A 和项目 B 中的每个存储库创建一个子存储库。

我不知道您何时第一次查看子存储库,但它们'已经存在一年了并且得到了很好的支持。

在堆栈溢出上阅读一些与子存储库相关的答案,确保在其中使您的子存储库路径相对(而不是绝对的 w/ http:// 等),他们会很好地对待您。

更新

今天的 Mercurial 1.7 版本包括对子存储库的以下增强功能:

  • 支持重新映射子存储库源路径(请参阅 hgrc(5) 中的 [子路径])
  • 使 add、diff、传入、传出和状态命令递归到带有 --subrepos/-S 的子存储库 子
  • 存储库:添加对“hg archive”的支持
  • 子存储库:修复 SVN 子存储库的状态检查(issue2445)

Your second call is correct. You should extract the files that would be in both repositories and make that a third repo, which you in turn make a sub repo for each of project A and project B.

I don't know when you first looked at subrepos, but they've been around for a year now and are supported quite well.

Read a few of the subrepo related answers here on stack overflow, make sure to make your subrepo paths relative (not absolute w/ http:// etc.) in them and they'll treat you very well.

Update:

Today's 1.7 release of mercurial includes these enhancements for subrepos:

  • support remapping of subrepository source paths (see [subpaths] in hgrc(5))
  • make add, diff, incoming, outgoing and status commands recurse into subrepos with --subrepos/-S
  • subrepo: add support for 'hg archive'
  • subrepo: fix status check on SVN subrepos (issue2445)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文