Merwok's Mercurial Scripts

This is a collection of tools that help me save time and work when working with
Mercurial.  Drop an email to if you like them, have found a
bug or have a feature request!


This is a copy of the hgeditor script included with Mercurial itself.  It lets
you see a diff when writing the commit message.  I edited it to make it smarter
with Vim.  To use it, set the editor option of the ui section of your .hgrc file
to the path of this script (see example in included sample.hgrc file).


Some use cases are not handled well by classic merge tools, which display panels
with the different versions of the file to merge (the common base, the newer
version of the first branch being merged, the newer version of the other branch
to merge, and sometimes another panel with the final version).  There is for
example a workflow named translations branches that uses named branches to
handle translations of a set of files.  The advantage of using named branches
instead of just translating files in a clone is that you don't have to read
pulled changesets to find out if there are changes in the files you've already
translated: hg merge does it for you.  The problem is that if your merge tool
shows you a translated French file in one panel and the newer English page in
another panel, you cannot easily see what are the changes made in the English
page: the whole page is different!  To fix this, I wrote this simple script that
displays the diff of the original file alongside the translated file (its name
means display-diff-merge-tool).  It lets you see directly the changes made
upstream and apply them as appropriate to your translated version.

To use this script as merge tool, first you should register it in the
merge-tools section of your .hgrc file (see example in included sample.hgrc
file), and then you can enable it on the command line:

   $ hg merge default --tool ddmt

To always use that tool in a specific clone, edit clone/.hg/hgrc and add
"merge = ddmt" in the ui section.  It’s also possible to configure this merge
tool only for certain files; see “hg help merge-tools” for more info.