This patch fixes my original problem. So,
Reported-by: Ramkumar Ramachandra <redacted>
Tested-by: Ramkumar Ramachandra <redacted>
However, test 4 in test-hg.sh still fails for me:
--- expected 2012-11-13 05:22:57.946637384 +0000+++ actual 2012-11-13 05:22:57.946637384 +0000