views:

113

answers:

3

I am working on a system that performs continuous integration and I am looking for a method I can use to get the most recent changeset from a Mercurial repository without creating a repository locally.

I have considered using clone but this method will only work if you have set a working directory locally (since this will be occurring on a build server, I would prefer not to do this because of inclusion of the .hg file and the diffs - all I want is essentially an export of the files from the tip revision and nothing more.)

This request may not even be possible, and it's very likely that I just do not understand DVCS very well. However, if I cannot do what I want to do, is there a workaround?

+2  A: 

You can use:

$ hg clone http://your_repo
$ hg archive ../export/
$ rm -rf *
$ cd ..
$ cd export

From Mercurial's help files:

$ hg help archive

hg archive [OPTION]... DEST

create an unversioned archive of a repository revision

Pablo Santa Cruz
When I do this, I get a "repository is not local" error... which seems to happen with every command, is there a way around this?
John Rasch
Ok John. Updated with something that might help...
Pablo Santa Cruz
@Pablo - thanks for the update, unfortunately if I clone the repo before using archive then I've still grabbed the entire history... but there seems to be no way around doing this at this point so I'll have some work ahead of me
John Rasch
+4  A: 

It's possible using 'hg archive' depending how your remote repository is set up.

If it's available over HTTP using hgweb.cgi or hg serve you can hit the archive link programmatically to get the files you want. Example:

wget http://selenic.com/hg/archive/tip.zip --output-document=- | unzip -

or it's available over ssh:

ssh [email protected] hg archive --type=zip - | unzip -
Ry4an
+1  A: 

You can use:

http://merc/raw-file

to retrieve a list of files in the repository or

http://merc/raw-file/filename

to get a specific file.

Steve Dennis