Perforce 与 Mercurial 的客户端规格映射类似

发布于 2024-10-01 10:01:03 字数 643 浏览 7 评论 0原文

我们最近从 Perforce 迁移到 Mercurial,并且非常喜欢它!

一个小问题:经过大量研究,我们无法弄清楚如何将存储库中的特殊目录映射到客户端上的某个特殊位置。以下是我们的 hg 存储库的示例:

/foo/source files
/bar/source files
/build
    /macosx/mac make files
    /win/windows make files

使用 Perforce,我们使用客户端规范映射将 //depot/build/macosx/... 映射到 Mac 客户端上的 /build/...,以及 //depot/build Windows 开发盒上的 /win/... 到 /build/...。目录 foo 和 bar 按原样同步。 /foo 和 /bar 中的 Makefile 假定我们的构建 makefile 位于 /build 中,并且我们希望保持它们原样。最终的客户端文件集应如下所示:

/foo/source files
/bar/source files
/build/client specific make files

我已阅读有关子存储库的内容,但此解决方案似乎并非特定于客户端。

任何如何解决这个问题的想法将不胜感激!

We recently moved from Perforce to Mercurial and love it!

One little problem: after much research we can't figure out how to map a special directory in the repository to some special place on the client. Here is an example of our hg repo:

/foo/source files
/bar/source files
/build
    /macosx/mac make files
    /win/windows make files

With Perforce, we were using client spec mappings to map //depot/build/macosx/... to just /build/... on the Mac client, and //depot/build/win/... to /build/... on the Windows dev box. Directories foo and bar are synced as is. Makefiles in /foo and /bar assume that our build makefiles are located in /build and we would like to keep them as is. The final client set of files should look like this:

/foo/source files
/bar/source files
/build/client specific make files

I've read about subrepos, but this solution does not seem to be client specific.

Any idea how to solve this problem will be very much appreciated!

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

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

发布评论

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

评论(3

却一份温柔 2024-10-08 10:01:03

您无法使用 Mercurial 仅签出存储库的部分内容。

您总是会得到一个包含所有内容的克隆,并且工作目录也将包含所有内容。

使用 Mercurial,您应该努力为 1 个项目拥有 1 个存储库,以便您获得的所有内容在逻辑上属于在一起,然后您不应该只需要其中的一部分。

这也意味着 Mercurial 存储库中的任何目录结构将始终与磁盘上的结构完全匹配。

You can't check out only portions of a repository with Mercurial.

You always get a clone containing everything, and the working directory will also contain everything.

With Mercurial you should strive to have 1 repository for 1 project, so that everything you get logically belongs together, and then you shouldn't have much need for just a portion of it.

This also means that whatever directory structure you have in your Mercurial repository will always match exactly the structure you have on disk.

终陌 2024-10-08 10:01:03

您无法使用 Mercurial 执行此操作,因为它没有与软件仓库分开的客户端概念。

但是,您可以在 Mac OS X (ln -s) 上使用符号链接,在 Windows 上使用联结(在 Vista 及更高版本上使用 XP 上的联结工具 http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx) 在文件系统级别解决此问题。

或者,您可以在 Makefile 中使用变量来引用构建目录(例如 $(BUILD)/something.ext 而不是 build/something.ext)。

You can't do this with Mercurial as it doesn't have the concept of a client separate from a depot.

However, you can use a symlink on Mac OS X (ln -s) and a junction on windows (mklink on Vista and up using the junction tool on XP http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx) to solve this problem on the file system level.

Alternatively you can use a variable in the Makefiles to refer to the build directory (eg $(BUILD)/something.ext instead of build/something.ext).

弥枳 2024-10-08 10:01:03

Mercurial 中无法完成此类映射。对于“窄”克隆有一个突出的 TODO 项目,因此您可以仅查看一个子目录。我可以看到支持此类功能的实现。但话又说回来,我知道这样的事情会被认为有点太“聪明”(读起来很复杂),并且这个想法会受到很多阻力。

同时,我建议这两种解决方案之一。

  1. 符号链接。将符号链接放入 .hgignore 文件中的 build 目录。然后每个人都可以创建自己的符号链接到构建文件的适当目录。这样做的缺点是无法在没有符号链接的平台上工作。
  2. 在顶级 makefile 中使用的环境变量,用于构造它应该调用的特定于平台的 makefile 的路径。

This sort of mapping cannot be done in Mercurial. There is an outstanding TODO item for 'narrow' clones so you can check out just a subdirectory. And I could see an implementation of that supporting that sort of functionality. But then again, I know that something like this would be considered a little too 'clever' (read complex) and there would be a lot of push-back on the idea.

In the meantime, I would suggest one of these two solutions.

  1. Symbolic links. Put the symbolic link to your build directory in your .hgignore file. Then each person can make their own symbolic link to the appropriate directory of build files. This has the disadvantage of not working on a platform without symbolic links.
  2. An environment variable that's used in a top level makefile to construct the path to the platform specific makefile it should be calling.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文