views:

57

answers:

4

Hello.

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.

+1  A: 

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
Matthew Flaschen
+2  A: 

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.

msw
Actually, a lot of folks do this and it works pretty great. Usually, one does a `push` to a production server which has `changegroupq hook that does an automatic `update`. There are a lot of questions here in stack overflow where just such a setup is recommended. Using a 'production' tag or the like as a target for the auto-update works very slick.
Ry4an
@Ry4an: Here is at least one counter argument which calls out the same issues that were of concern to me. It isn't "right" but it was the only relevant one that my search turned up and I'd love to see a representative from the other side. If you are using a commit hook, then it seems there must be an implicit "install" script which is just triggered from hg. I've never done a direct deploy, so I'd like to learn what "boat" I've missed. http://stackoverflow.com/questions/2361708/using-hg-repository-as-web-site
msw
After looking at my project again, I must agree with msw. I'm over complicating things here, it seems that I should be just version controlling my actual Django project folder and not stuff around it. In this situation, that makes sense. Thanks.
littlejim84
+1  A: 

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.

ben
A: 

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.

Ry4an