comparison mercurial/context.py @ 34131:0fa781320203

doctest: bulk-replace string literals with b'' for Python 3 Our code transformer can't rewrite string literals in docstrings, and I don't want to make the transformer more complex.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 03 Sep 2017 14:32:11 +0900
parents f698bb31bdfb
children 255c761a52db
comparison
equal deleted inserted replaced
34130:ada8a19672ab 34131:0fa781320203
1110 data. 1110 data.
1111 1111
1112 Additionally, if `skipchild` is True, replace all other lines with parent 1112 Additionally, if `skipchild` is True, replace all other lines with parent
1113 annotate data as well such that child is never blamed for any lines. 1113 annotate data as well such that child is never blamed for any lines.
1114 1114
1115 >>> oldfctx = 'old' 1115 >>> oldfctx = b'old'
1116 >>> p1fctx, p2fctx, childfctx = 'p1', 'p2', 'c' 1116 >>> p1fctx, p2fctx, childfctx = b'p1', b'p2', b'c'
1117 >>> olddata = 'a\nb\n' 1117 >>> olddata = b'a\nb\n'
1118 >>> p1data = 'a\nb\nc\n' 1118 >>> p1data = b'a\nb\nc\n'
1119 >>> p2data = 'a\nc\nd\n' 1119 >>> p2data = b'a\nc\nd\n'
1120 >>> childdata = 'a\nb2\nc\nc2\nd\n' 1120 >>> childdata = b'a\nb2\nc\nc2\nd\n'
1121 >>> diffopts = mdiff.diffopts() 1121 >>> diffopts = mdiff.diffopts()
1122 1122
1123 >>> def decorate(text, rev): 1123 >>> def decorate(text, rev):
1124 ... return ([(rev, i) for i in xrange(1, text.count('\n') + 1)], text) 1124 ... return ([(rev, i) for i in xrange(1, text.count(b'\n') + 1)], text)
1125 1125
1126 Basic usage: 1126 Basic usage:
1127 1127
1128 >>> oldann = decorate(olddata, oldfctx) 1128 >>> oldann = decorate(olddata, oldfctx)
1129 >>> p1ann = decorate(p1data, p1fctx) 1129 >>> p1ann = decorate(p1data, p1fctx)