ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Question re archiving/retrieving directories and subdirs using Mercurial


I was thinking of using Mercurial to keep revision history of the various manuscripts I proofread for various Kindle authors. The image below shows a screen shot of the main directory, /manuscripts/ and the /.hg/ repository that I created for it with TortoiseHg Workbench. Here's my question. If I zipped that /.hg/ repo directory and uploaded it to my website, and then... say... a year later my hard drive crashed (assume I don't have backups on removable media), could I (a) download and unzip the /.hg/ repo and, (b) using cmdline or Workbench, reconstitute the original directories inside /manuscript/ ? If so, any brief explanation about how?

That trick you suggest, does work with a file-based repository. If your repository is stored in a database of some sorts, than all bets are off.

Verify if your setup uses a database or not, because I know from experience that SVN uses the database mode. Although Git looks like it uses file-based versioning, completely sure I am not. The same is true for Mercurial.

An example:
I personally have done this with CVS repositories. I copied the original CVS repository (all files and the .cvs folders!) from a Linux machine to a Windows machine, installed the WinNT CVS server software on the Windows PC, Then just pointed the server software to the copied repository and started the server software. That was it, all changes/comments (15 years worth!) were available.

To my understanding, you can change the mode from modern versioning software only during creation of the repository. File based repositories tend to take up more storage space than repositories that use a database. So if you have the space I would use a file based repository, for the easy backup/restore procedure.

Thanks, Shades!

Mercurial contains the entire repository history in that .hg folder. So the answer to your question is, yes, you can backup the .hg folder and reconstruct everything in the repository (at the date it was backed up) from that.

You would do it by running the update command to whichever revision you wanted. I use a GUI interface so I'm a little unsure about the exact command you'd run, but something like "hg update tip" should make the folder/file structure to be exactly as it was as of the most recent revision (at the time of backing up the .hg folder).

If you use something like TortoiseHg, you could visually browse the repository and manually update to specific revisions by right clicking the one you want and selecting Update from the context menu.

You may want to consider having copies of your repositories on a site like, which allows you to have private repos (for free) which will essentially automatically handle backing things up for you, as you can just push or pull to/from the bitbucket repo to backup/restore things.

Thanks, Deozaan. I'm pushing my proofreading manuscripts to BitBucket right now...


[0] Message Index

Go to full version