Poojan (Wagh) Blog

Requests for comment

Picture-by-Picture: Setting up Mercurial with WikidPad

without comments

I’m personally using Git to version-control my WikidPad files. However, Mercurial (and especially TortoiseHg) is equally well suited for this function. In many respects, Mercurial is simpler to use than Git. The only shortcoming I had with Mercurial is that there’s no managed branches; to branch, you create an independent copy of the whole repository (clone it).

Nonetheless, for most people, Mercurial will not only suffice but give quicker rewards than Git.

I don’t use Subversion for this purpose, because subversion has a centralized approach which requires a repository, separate from a working copy. Importing, merging, branching, etc., with subversion is a bit of a hassle. This “hassle”, of course, is purely personal taste; others will (strongly) disagree. In fact, for many other purposes, I strongly prefer Subversion to Mercurial/Git/etc.

Goal

By the time you’re done with the following steps, you should be able to:

  1. Place a WikidPad Wiki under version control
  2. Commit changes as files change
  3. Revert to prior versions

Set Up and First Steps

  1. Download Mercurial with TortoiseHG (I chose TortoiseHg 0.5 w/ Mercurial 1.02).
    SourceForge Mercurial/TortoiseHg site

    Use FireFox
  2. Install TortoiseHg/Mercurial:
    image
    image
    image
  3. Restart computer (if installing TortoiseHg)
  4. Optional: Create a new “Original SQLite” format wiki using WikidPad:
    image
  5. Create a new folder for it (for example on your Desktop):
    image
    image
    Note that the hierarchy will be:
    image
  6. Select Original SQLite format:
    image
  7. In Windows Explorer, Right-Click on the new Wiki Directory, select TortoiseHG->“Create Repository Here”:
    image
    image
  8. TortoiseHG->Add Files:
    image
  9. Select all files & click “Add” button:
    image
  10. Now, click “HG Commit”:
    image
  11. Type in some text (“Initial check-in of blank wiki”) & hit Commit:
    image

    Since wikidpad is open, there’s a .lock file. Normally, we don’t want to check that in (it’ll cause conflicts when we try to edit our working copy later), but we’ll do so right now. I’ll show you how to get rid of it (WikidPad will automatically delete it for us) and ignore it in the future.

  12. Make some edits:
    image
  13. Close WikidPad
  14. Go back up to the parent directory (two levels up), right-click it, and select TortoiseHG->“View File Status”:
    image
  15. Note the changes (lock file missing) & .wiki files modified:
    image
    Cancel.
  16. Go to TortoiseHG Commit:
    image
  17. Select all changes & type in a commit message:
    image
    Hit “commit” button.
  18. Open the wiki again:
    image
  19. This time, right-click on the .lock file (or anywhere else), and select “HG Commit”:
    image
  20. Right click on the .lock file and select “Add ignore” … :
    image
  21. You’ll notice that the “.lock” file disappears, but .hgignore is now modified (“M” code):
    image
  22. Add a similar ignore attribute for the .sli-journal file:
    image
  23. Type in a commit message and hit “Commit”:
    image

That’s it: as you continue to edit, you can continue to commit as you wish.

Reverting

You can revert back to a previous version by selecting “Tortoise HG”->”Update to Revision”:
image

You can then browse revisions (designated by an index number and a hash):
image
image

Written by PoojanWagh

October 21st, 2008 at 12:34 am

Leave a Reply