Mercurial > hg
diff hgext/convert/darcs.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 | b9296b330a54 |
children | 671aba341d90 |