How-to: Use Mercurial with EditPlus

I use EditPlus for most of my non-Visual Studio development. I’ve recently begun extending its functionality to use it as a “lite” PHP IDE by invoking php.exe from the commandline and capturing the output. I’ve also begun using Mercurial as my version control system of choice, and wondered if it would be possible to invoke hg from within EditPlus.

Turns out you can, and it’s quite easy. I find it best to configure Mercurial with an existing set of tools. I’m doing a lot of PHP right now, so that’s where I’ve stuck it.

  1. Add Mercurial to your PATH Environment variable using the method I outlined in this post.
  2. In EditPlus, configure your user tools: Tools > Configure User Tools
  3. Add Tool > Program
    Add tool
  4. Fill out the field as displayed, making modifications to suit your preferences:
    EditPlus Mercurial preferences

Details

  • "$(FileDir)" is the EditPlus variable indicating the directory that your current source file resides in. I have it enclosed in quotes, because sometimes directories or filenames have spaces in them.
  • -v indicates that I prefer verbose output. By default, mercurial will only display output if there has been an error, but I prefer to see success messages as well.
  • -m indicates a commit message.
  • "$(Prompt)" tells EditPlus to display a dialog that I can type in. This is where I put my commit message. I have it enclosed in quotes so I don’t have to worry about spaces breaking the commit message. You may need to escape more exotic characters; I have not tested it.

Caution

This method commits the working directory that your source file is in. This may or may not make sense, depending on the directory structure of your project. If you are concerned about the integrity of your atomic commits, it might make sense to configure your arguments differently, or to commit using the commandline or TortoiseHg.

Here’s the output as I see it in my editor:
EditPlus mercurial output capture

Here is a log of the commit messages as viewed with TortoiseHg:
EditPlus TortoiseHg log file viewer

Leave a Reply

Your email address will not be published.