创建 Mercurial 存储库的本地透明缓存
我有很多不同的克隆,我分别进行研究。当我想要更新这些克隆时,从服务器更新它们可能会非常慢。因此,我有一个“干净”的克隆,我定期从服务器更新它,并且所有其他克隆都从干净的克隆中克隆(希望这是有意义的)。
但现在我有一个两步走的方法。首先转到干净的克隆并拉取,然后转到我正在处理的真正克隆并从干净的克隆中拉出。这可以变成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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在本地保留一个干净的克隆是很常见的,而且一般来说是一个好主意。我一直坚持您描述的两步过程,但如果您愿意,您可以使用钩子来完成此操作。
在您的缓存存储库中,您可以将类似的内容放入
.hg/hgrc
文件中:它告诉存储库在之前执行
hg pull
它会捆绑更改以响应对其发出的pull
或clone
请求。请注意,即使下游(真正的克隆)存储库使用
pull -r
或clone -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:which tells that repo to do a
hg pull
before it bundles up changes in response to apull
orclone
request made on it.Note that even if the downstream (real clone) repo requests a subset of the changesets using
pull -r
orclone -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.您可以使用 钩子。在您的
/.hg/hgrc
中,将这些添加为初稿:(注意:“
autopush
”和“autopull
" 是可选标识符,没有特殊含义;如果没有定义其他钩子,则可以将其省略。)You can do this using hooks. In your
<clean-clone>/.hg/hgrc
, add these as a first draft:(Note: "
autopush
" and "autopull
" are optional identifiers with no special meaning; you can leave them out if you have no other hooks defined.)