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 as 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', ''] |