[Fixed]-How do clone a Mercurial repository into a directory that already exists?


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.



Copying just the .hg dir definitely works, but you could also do a hg init and then hg 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 as hg clone --pull with a manual init.


You can copy just the .hg folder, then revert or update to tip. E.g.:

cp -a src/.hg dest/
cd dest
hg up -C


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.


Leave a comment