comparison hgext/mq.py @ 34137:a8994d08e4a2

doctest: use print_function and convert bytes to unicode where needed
author Yuya Nishihara <yuya@tcha.org>
date Sun, 03 Sep 2017 14:56:31 +0900
parents 0fa781320203
children 0f9936d80e01
comparison
equal deleted inserted replaced
34136:414a3513c2bd 34137:a8994d08e4a2
60 60
61 This extension used to provide a strip command. This command now lives 61 This extension used to provide a strip command. This command now lives
62 in the strip extension. 62 in the strip extension.
63 ''' 63 '''
64 64
65 from __future__ import absolute_import 65 from __future__ import absolute_import, print_function
66 66
67 import errno 67 import errno
68 import os 68 import os
69 import re 69 import re
70 import shutil 70 import shutil
153 } 153 }
154 154
155 def inserthgheader(lines, header, value): 155 def inserthgheader(lines, header, value):
156 """Assuming lines contains a HG patch header, add a header line with value. 156 """Assuming lines contains a HG patch header, add a header line with value.
157 >>> try: inserthgheader([], b'# Date ', b'z') 157 >>> try: inserthgheader([], b'# Date ', b'z')
158 ... except ValueError, inst: print "oops" 158 ... except ValueError, inst: print("oops")
159 oops 159 oops
160 >>> inserthgheader([b'# HG changeset patch'], b'# Date ', b'z') 160 >>> inserthgheader([b'# HG changeset patch'], b'# Date ', b'z')
161 ['# HG changeset patch', '# Date z'] 161 ['# HG changeset patch', '# Date z']
162 >>> inserthgheader([b'# HG changeset patch', b''], b'# Date ', b'z') 162 >>> inserthgheader([b'# HG changeset patch', b''], b'# Date ', b'z')
163 ['# HG changeset patch', '# Date z', ''] 163 ['# HG changeset patch', '# Date z', '']