-1

I'm trying to find the fastest way to get all the files from a particular changeset; I don't care about the history.

The best thing I've found so far is to cd into the repository, and then

hg archive -u <changeset> /path/to/put/files

But I'm finding even that is quite slow on a large repository, even though it doesn't create the .hg folder.

I was thinking maybe I could use hg update instead because that seems to run a bit faster, but I don't want to update the current directory, I want the files to be written to a new directory outside the current repo. Is that possible?

Or is there some other quick way?

mpen
  • 272,448
  • 266
  • 850
  • 1,236
  • There is no better or faster way in general. `hg archive` is meant for exactly that purpose and it's usually the best way to export the repository state as of a certain revision. – planetmaker Dec 23 '15 at 01:24
  • Even after an update (with the undesired side-effects) the files would need to be copied out.. – user2864740 Dec 23 '15 at 02:10
  • Another way is to [clone to a particular revision](http://stackoverflow.com/questions/4148234/how-can-you-clone-a-mercurial-repository-as-of-a-specific-changeset) and and then to ["uninit"](https://github.com/wertarbyte/etckeeper/blob/master/uninit.d/50vcs-uninit). Will it be faster or better in any way? I doubt it (as it also duplicates the initial store's ancestor history); but it will accomplish the requested task without modifying the current working copy. YMMV. – user2864740 Dec 23 '15 at 02:13

1 Answers1

1

You can try the following to speed things up a bit:

hg archive --config ui.archivemeta=false /path/to/target

This option suppresses the generation of .hg_archival.txt, which can sometimes be relatively expensive to generate.

Also, hg update can be faster locally because not all files have to be updated (only the ones that were changed relative to the current revision). A fresh update after a hg clone -U or hg share -U should not be any faster.

You can try a recursive hardlink (via cp -al or a similar tool) followed by hg update, but then you have to be extra careful, because modifying files in one checkout can affect the ones in the other. This is only an option if you want a read-only copy or if you know (as in, positively know, not just guess) that you won't do any in-place modification of any of the files.

Reimer Behrends
  • 8,600
  • 15
  • 19
  • Hardlink might work. I'm just using it to do a build and then deleting the entire directory afterwords which should prevent accidental modification. Thanks for the suggestions! – mpen Dec 23 '15 at 16:54