The TrimRight is another trivial fix. Hg has a "+" appended in the revision numbers.
Not trimming creates trouble for some cases.