views:

59

answers:

3

I've tried using archive in Tortoise HG by opening my repo change log. This doesn't seem to be anything like SVN's export command, where I can simply export a remote repository to the current directory. I use this to get a clean copy of my source for production (without notes and repository data). How can I do something like this in HG? Or, should I just use clone and deal with the repo related data manually?

BTW, I need to do this all via command line since I'm not going to be using Tortoise HG on my Linux server.

Any help is much appreciated.

+1  A: 

You want the archive option I think...

Try:

hg help archive

You can export the archive as just files, or as tar/zip/etc.

The key is that with archive you start in the repo and specify the destination, vs. in subversion where you start in the destination and specify the location of the repo.

Mercurial doesn't seem to have many options for operating on remote repositories, other than clone and related commands.

John Weldon
@John Weldon - So, I can do `archive` and pass a repository's URI to that function somehow and it'll bring the files to my current directory? That's what I tried before but I must have had some syntax error, or something.
orokusaki
@orokusaki - from within a repository, do the `archive` command and specify the desired output location in the args.
John Weldon
+1  A: 

As other responses have pointed out hg archive can do what you want -- it will do archive files or just a file layout, but if you can run mercurial on the server might I suggest making the server a clone, with a hook that updates whenever new changesets are received? So long as you're not editing on the live server there won't be merge conflicts, so it's a safe action.

On the server:

hg clone ssh://host//path/to/dev/repo

and in the server's .hg/hgrc file add these lines

[hooks]
changegroup = hg update

Then as you update on the dev repo to deploy you just do:

hg push ssh://server/path/to/deployrepo

and then you can push from your repo to your server and it'll automatically update.

Ry4an
@Ry4an - that's pretty cool. What if I want to host my repository on BitBucket and pull the source directly from their via my server?
orokusaki
That'll work just fine. Log in to your server and do a hg pull followed by an hg update.
Ry4an
+1  A: 

If you want an output directory free of all repository data, simply delete the .hg directory after you clone.

basszero