Try $ echo 'ABC' > foo $ echo -n 'DEF' >> foo $ hg add foo $ hg ci -m "add foo" $ hg grep A foo:1:ABC $ hg grep D foo:1:DE notice the missing F. Seems like mercurial is eating the last character when the file does not end in a newline.
Fixed by http://selenic.com/repo/hg/rev/0e34699d6988 Mads Kiilerich <mads@kiilerich.com> grep: correct handling of matching lines without line ending (issue3050) (please test the fix)
Yes, the fix works even with my more complicated repository. Thanks
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:24 EDT --- This bug was previously known as _bug_ 3050 at http://mercurial.selenic.com/bts/issue3050