创建 Mercurial 存储库的本地透明缓存

发布于 2024-09-27 10:56:23 字数 243 浏览 4 评论 0原文

我有很多不同的克隆,我分别进行研究。当我想要更新这些克隆时,从服务器更新它们可能会非常慢。因此,我有一个“干净”的克隆,我定期从服务器更新它,并且所有其他克隆都从干净的克隆中克隆(希望这是有意义的)。

但现在我有一个两步走的方法。首先转到干净的克隆并拉取,然后转到我正在处理的真正克隆并从干净的克隆中拉出。这可以变成1步吗?

理想情况下,“干净”的克隆应该是透明的:当它被拉出时,它会自行拉动。这样我们就有了缓存和一步。有办法做到这一点吗?

I have lots of different clones which I work on separately. When I want to update those clones, it can be quite slow to update them from the server. So instead I have a "clean" clone, which I update from the server regularly, and all the other clones clone from the clean clone (hope that makes sense).

But now what I have is a two-step approach. First go to the clean clone and pull, and then go to the real clone i'm working on and pull from the clean clone. Can this be made into 1 step?

Ideally, the "clean" clone would be transparent: when it's pulled from, it would do a pull itself. That way we'd have caching and 1-step. Is there a way to do this?

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

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

发布评论

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

评论(2

自由如风 2024-10-04 10:56:23

在本地保留一个干净的克隆是很常见的,而且一般来说是一个好主意。我一直坚持您描述的两步过程,但如果您愿意,您可以使用钩子来完成此操作。

在您的缓存存储库中,您可以将类似的内容放入.hg/hgrc文件中:

[hooks]
preoutgoing = hg pull

它告诉存储库在之前执行hg pull它会捆绑更改以响应对其发出的pullclone 请求。

请注意,即使下游(真正的克隆)存储库使用 pull -rclone -r 请求变更集的子集,此缓存存储库也会拉倒一切。这可能就是您想要的,因为您的目标是一面镜子,但评论者指出值得指出。

Keeping a clean clone locally is very common and a good idea in general. I've always stuck with the two step process you describe, but you could do this with hooks if you wanted.

In your cache repos you'd put soemthing like this in the .hg/hgrc file:

[hooks]
preoutgoing = hg pull

which tells that repo to do a hg pull before it bundles up changes in response to a pull or clone request made on it.

Note that even if the downstream (real clone) repo requests a subset of the changesets using pull -r or clone -r this cache repo will pull down everything. That's likely what you want since your goal is a mirror but the commenter points it's worth pointing out.

残龙傲雪 2024-10-04 10:56:23

您可以使用 钩子。在您的 /.hg/hgrc 中,将这些添加为初稿:(

[hooks]

# Before a pull from this repository, pull from upstream.
preoutgoing.autopull = [ $HG_SOURCE = 'pull' ] && hg pull

# After a push to this repository, push to upstream.
changegroup.autopush = [ $HG_SOURCE = 'push' ] && hg push

注意:“autopush”和“autopull" 是可选标识符,没有特殊含义;如果没有定义其他钩子,则可以将其省略。)

You can do this using hooks. In your <clean-clone>/.hg/hgrc, add these as a first draft:

[hooks]

# Before a pull from this repository, pull from upstream.
preoutgoing.autopull = [ $HG_SOURCE = 'pull' ] && hg pull

# After a push to this repository, push to upstream.
changegroup.autopush = [ $HG_SOURCE = 'push' ] && hg push

(Note: "autopush" and "autopull" are optional identifiers with no special meaning; you can leave them out if you have no other hooks defined.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文