topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 8:26 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Question re archiving/retrieving directories and subdirs using Mercurial  (Read 3147 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
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?

Hg.png

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
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.


kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Thanks, Shades!

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
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 http://bitbucket.com/, 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.

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Thanks, Deozaan. I'm pushing my proofreading manuscripts to BitBucket right now...