Mercurial > hg-stable
diff tests/test-annotate.t @ 35831:0a7c59a4c835 stable
annotate: do not poorly split lines at CR (issue5798)
mdiff and lines(text) take only LF as a line separator, but str.splitlines()
breaks our assumption. Use mdiff.splitnewlines() consistently.
It's hard to read \r in tests, so \r is replaced with [CR]. I had to wrap
sed by a shell function to silence check-code warning.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 21 Feb 2018 21:14:05 +0900 |
parents | feecfefeba25 |
children | 9a08f7d18c20 b529e640015d |
line wrap: on
line diff
--- a/tests/test-annotate.t Fri Feb 23 17:57:04 2018 -0800 +++ b/tests/test-annotate.t Wed Feb 21 21:14:05 2018 +0900 @@ -895,6 +895,38 @@ $ cd .. +Annotate with orphaned CR (issue5798) +------------------------------------- + + $ hg init repo-cr + $ cd repo-cr + + $ substcr() { + > sed 's/\r/[CR]/g' + > } + + >>> with open('a', 'wb') as f: + ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') + $ hg ci -qAm0 + >>> with open('a', 'wb') as f: + ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') + $ hg ci -m1 + + $ hg annotate -r0 a | substcr + 0: 0a[CR]0b[CR] + 0: 0c[CR]0d[CR] + 0: 0e + 0: 0f + 0: 0g + $ hg annotate -r1 a | substcr + 0: 0a[CR]0b[CR] + 1: 1c[CR]1d[CR] + 0: 0e + 1: 1f + 0: 0g + + $ cd .. + Annotate with linkrev pointing to another branch ------------------------------------------------