Mercurial > hg
comparison hgext/share.py @ 30040:3e3f2201bbdf
annotate: calculate line count correctly
Before this patch, the "lines" function inside "annotate" returns 1 for
empty text (''). This patch makes it 0. Because the function should match
mdiff.splitnewlines (used by mdiff.allblocks), or s.splitlines (used at the
end of the "annotate" method). Both len(mdiff.splitnewlines('')) and
len(''.splitlines(True)) are 0.
This issue was discovered while testing fastannotate [1].
I could not find a test case to reveal this issue. However in theory this
could reduce memory usage a little bit, and avoids surprises when people
are touching this area in the future.
[1]: https://bitbucket.org/facebook/hg-experimental/commits/525b3b98e93a
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 01 Oct 2016 14:18:58 +0100 |
parents | d5883fd055c6 |
children | 0332b8fafd05 |
comparison
equal
deleted
inserted
replaced
30039:ff7697b436ab | 30040:3e3f2201bbdf |
---|