Add some linting of the commit message itself.  "Test plan:" is required.

Summary:
Based on our meeting today, we're going to require "Test plan:"
sections for all commits, either saying what tests were run, or
describing the manual testing steps taken.

Phabricator has built-in support for requiring "Test plan:".  This
commit adds such support for mercurial, via a precommit hook.

Automatically add 'Test Plan:' to the commit template for hg.

To use this, you should put the following line in your .hgrc:
--
[ui]
username = Craig Silverstein <csilvers@khanacademy.org>
editor = ~/khan/khan-linter/hgeditor.sh "${VISUAL-$EDITOR}"
--
(You can modify this depending on where you put khan-linter, and you
specify any default editor as $1, rather than "${VISUAL-$EDITOR}".)

You also need
--
[hooks]
pretxncommit.lint = ~/khan/khan-linter/hghook.py
--
for the pre-commit check.

Also, change the linter to allow either 'Test Plan:' or 'Review:', so
you don't have to specify a test plan when updating an existing
review.  Also, allow any capitalization of 'test plan:'.

Fix up the merge code.

Allow the commit message to remain unchanged for merges.

Fix a typo.

This typo seems like it would matter, but doesn't, because any
lack-of-changes here would be detected in the linter (which is what
happened before).  But still, it's better to be self-contained.

Test Plan:
Submitted several commits to hg both with and without a 'Test plan:'
line, and verified these commits either succeeded or failed as
appropriate.

1) Create a trivial change in stable (added a blank line to main.py)
2) env VISUAL="emacs -nw" hg commit
   -- verified it showed up in the same screen (-nw is respected)
   -- verified it had the template.
3) C-x C-c to edit without making any changes
   -- verified it said 'abort: empty commit message'
4) env VISUAL=vi hg commit
   -- verified it used vi this time
5) Deleted the test plan line and saved-and-exited (commands: jjddZZ)
   -- verified commit failed with 'Missing "Test plan:"' message
6) env EDITOR=vi hg commit
   -- verified it used emacs (VISUAL is set to emacs for me)
7) Replaced the first line with 'Hello', but left other lines unchanged.
   -- verified commit failed with 'Must enter a "Test plan:"' message
8) hg commit
9) Changed the "<see below>" line to "None" but kept the first line the same.
   -- verified commit failed with 'Must enter a summary' message
10) hg commit
11) Changed the first line to "hi" and the "<see below>" line to "None"
    -- verified commit succeeded.
12) hg rollback
13) Changed the first line to "hi" and deleted "Test plan:" and the
    next line, replacing them with "Review: K12345".
    -- verified commit succeeded.
14) hg rollback
15) Changed the first line to "hi", changed "<see below>" to
    "different", and added a line under it, "Review: K12345"
    -- verified commit succeeded
16) hg rollback

I did not test the merge code (where it leaves out "Test plan:")
because I didn't have a convenient merge to test on.  I *did* test the
merge code in 'hghook' (that the hook ignores merges) for a previous
commit.

Finally got to test on a merge codepath!
1) hg merge
2) hg commit
   -- verified the editor said 'merge'
3) exited the editor without saving
   -- verified hg complained and rejected the commit.
4) hg commit
5) changed the text to say 'merge.' and exited the editor
   -- verified the commit succeeded

1) Made a trivial change to main.py (removed a blank line)
2) hg commit
3) Exited the editor without making any changes
   -- verified the commit failed with 'Must enter a "Test plan:"'/etc.
4) hg rollback
Then waited for a merge, and ran
1) hg merge
2) hg commit
3) Exited the editor without making any changes
   -- verified the commit succeeded

1) Make a trivial change to main.py (delete a blank line).
2) hg commit
3) Exit the editor without making any changes
4) Verify it fails with 'abort: empty commit message'

Reviewers: benkomalo

Reviewed By: benkomalo

CC: alpert

Differential Revision: http://phabricator.khanacademy.org/D738