如何将 Mercurial 存储库克隆到已存在的目录中?
我有一个客户的 Django 项目,正在本地开发,使用 Mercurial 进行版本控制。我将本地存储库推送到我的个人远程服务器(我保存所有项目的地方),然后当我部署它时(无论在哪个 Web 服务器上),我都会从我的个人服务器克隆该存储库。
这在大多数服务器(我拥有完全控制权)上运行良好,但我有一些项目部署到 WebFaction 上。 WebFaction 很棒,但它的设置有点不寻常,因为我需要首先通过控制面板将 Django 项目声明为“应用程序”。这会自动创建一些东西,例如“apache2”、“myproject”等文件夹。尽管我想从我的个人远程服务器克隆存储库,但它也是同一个文件夹。执行通常的 hg clone 命令不起作用,因为它说目标文件夹已经存在。对于这个文件夹的内容我无能为力,所以我需要解决这个问题。
我不是 Mercurial 的专家,我似乎解决这个问题的唯一方法是将其克隆到另一个文件夹,然后将所有内容(包括 .hg)移动到我想要的实际文件夹中。但这看起来很愚蠢...
我正在使用 Mercurial v1.6.2(通过 easy_install 安装)。有人可以分享一些关于此的信息吗?
非常感谢。
I have a client's Django project that I'm developing locally, using Mercurial for version control. I push my local repository to my personal remote server (where I keep all my projects) and then when I come to deploy it (on whichever web server) I clone that respository there from my personal server.
This works fine on most servers (where I have total control) but I have a few projects where I'm deploying on to WebFaction. WebFaction is great, but a little unusual with it's setup, as I need to first declare the Django project as an 'application' through their control panel. This creates a few things automatically, such as an 'apache2', 'myproject', etc folder. It's this same folder though where I want to clone the repository from my personal remote server. Doing the usual hg clone command just doesn't work though as it says the destination folder already exists. There isn't much I can do about the contents of this folder really, so I need to work around this.
I'm not an expert at Mercurial and the only way I could seem to work it out is clone it to another folder and then moving all the contents (including the .hg) into the actual folder I want. This seems silly though...
I'm using Mercurial v1.6.2 (installed through easy_install). Could anyone share some light on this?
Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
仅复制 .hg 目录肯定有效,但您也可以执行
hg init
然后hg pull http://remote/repo
。刚刚初始化的存储库只有 000000000000000 变更集,因此您可以从任何存储库中提取内容,而不会收到“不相关的存储库”警告。这本质上与手动初始化的hg clone --pull
相同。Copying just the .hg dir definitely works, but you could also do a
hg init
and thenhg pull http://remote/repo
. A repo that has just been initalized has only the 000000000000000 changeset, so you can pull from any repo without getting the "unrelated repos" warning. This is essentially the same ashg clone --pull
with a manual init.您可以仅复制
.hg
文件夹,然后恢复或更新到提示。例如:You can copy just the
.hg
folder, then revert or update to tip. E.g.:您可以在事后移动该文件夹,也可以只创建一个符号链接到它。我的 webfaction 目录实际上是符号链接的,所以我知道它工作正常。
you can either move the folder after the fact, or you can just make a symlink to it. my webfaction directory is actually symlinked, so i know it works fine.
总的来说,看起来您可能正在尝试使用 Mercurial 作为安装管理器,这当然不是它的设计目标。
如果我没理解错的话,源存储库的一部分应该类似于
make deploy
,它将文件放入正确的位置。换句话说,在部署目录中拥有存储库克隆(在.hg
中)似乎很奇怪并且容易出现问题。In the main, it looks like you might be trying to use Mercurial as an installation manager which is certainly not its design goal.
If I am reading you correctly, part of your source repository should be something like
make deploy
which puts the files into their proper places. Put another way, having a repository clone (in.hg
) in your deployment directory seems odd and trouble-prone.