如何在不再次拉子仓库的情况下进行本地克隆? [英] How to make local clone without pulling subrepos again?

查看:89
本文介绍了如何在不再次拉子仓库的情况下进行本地克隆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常与Mercurial一起工作,即在本地存储上游克隆,然后再针对我的实际工作环境在本地再次克隆:

I often work with Mercurial by keeping a local store of my upstream clones, and then just cloning again locally for my actual working environment:

$ cd /clones
$ hg clone ssh://external-repo.example.com/some/repo/path/foo
$ cd ~/Development
$ hg clone /clones/foo

这对我特别有用,因为我经常想在无法访问互联网的飞机等上制作新的克隆.但是,当原始克隆包含subrepos时,这将不起作用-.hgsubstate文件的存在意味着hg始终会出入互联网,而不是获取本地克隆的修订版(即使它们是相同).有什么方法可以使本地克隆在不访问互联网的情况下复制文件?

This is particularly useful for me because I often want to make new clones on airplanes, etc., where I have no internet access. However, this doesn't work when the original clone contains subrepos - the presence of the .hgsubstate file means that hg will always go out to the internet instead of grabbing the local cloned revision (even if they are the same). Is there any way to make a local clone copy the files without going out to the internet?

此问题有一个可能有效的答案,但对于长期管理而言,这似乎是非常不幸的(将/clones/中的克隆中的.hgsubstate文件删除,然后从中进行本地克隆).

This question has an answer which would probably work, but seems very unfortunate for long-term management (deleting the .hgsubstate file in the clone in /clones/, and then making local clones from that).

推荐答案

您可以在.hgsub文件中使用简单"子存储库路径,如下所示:

You can use a "trivial" subrepository path in your .hgsub file like this:

foo = foo
bar = bar

这是推荐的设置.设置布局的优点是,克隆与从中克隆的存储库具有相同的结构.因此,您可以在飞机上克隆克隆.

This is the recommended setup. The advantage of setup a layout is that a clone has the same structure as the repository you clone from. You can thus clone your clones when on a plane.

或者,您可以将 [subpaths] 设置为将URL重新映射到本地路径.这可以让您添加

Alternatively, you can use the [subpaths] setting to re-map the URLs to local paths. This lets you add

[subpaths]
http://server/(.*) = /clones/libs/\1

~/.hgrc文件,然后您将看到克隆后路径重新映射到/clones/libs.

to your ~/.hgrc file and then you'll see that paths are remapped to /clones/libs when you clone.

这篇关于如何在不再次拉子仓库的情况下进行本地克隆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆