更改Mercurial“默认”父URL

时间:2009-05-13 22:31:31

标签: mercurial

假设我有一个Mercurial存储库,我从一个默认的父URL(我克隆它的源代码)中提取。

现在我想更改默认的父URL(主机名更改,或者它已复制到另一台计算机等)。有没有办法做到这一点,还是我必须从新的URL重新克隆?

3 个答案:

答案 0 :(得分:146)

您甚至可以在.hg / hgrc文件的[路径]部分添加多个条目。

[paths]
default = /repo_store/hg/project1
sandbox = /repo_store/hg/project1_experimental

然后可以在mercurial命令中指定其别名。不需要指定默认仓库,但其他人必须如此,

hg in            # check incoming changes from default repo
hg in default    # check incoming changes from default repo
hg in sandbox    # check incoming changes from sandbox repo
hg pull sandbox  # pull changes from sandbox repo

答案 1 :(得分:54)

我刚刚找到了自己问题的答案。编辑存储库中的.hg/hgrc文件,更改default部分下的[paths]设置。简单!

答案 2 :(得分:3)

为Mercurial推拉设置默认BitBucket存储库的示例。

通常我们可以使用

$ hg push https://bitbucket.org/username/com.example.app

但是如果我们想在没有存储库URL的情况下使用$ hg push,我们必须将URL添加到文件$ REPO / .hg / hgrc中。我们添加以下内容:

[paths]
default = https://bitbucket.org/username/com.example.app

关于您的问题,只需将default路径设置为新网址。