Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.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 | 61714510220d |
comparison
equal
deleted
inserted
replaced
34136:414a3513c2bd | 34137:a8994d08e4a2 |
---|---|
4 # Copyright 2007 Chris Mason <chris.mason@oracle.com> | 4 # Copyright 2007 Chris Mason <chris.mason@oracle.com> |
5 # | 5 # |
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 from __future__ import absolute_import | 9 from __future__ import absolute_import, print_function |
10 | 10 |
11 import collections | 11 import collections |
12 import copy | 12 import copy |
13 import email | 13 import email |
14 import errno | 14 import errno |
1503 >>> fp = util.stringio() | 1503 >>> fp = util.stringio() |
1504 >>> for c in reversedhunks: | 1504 >>> for c in reversedhunks: |
1505 ... c.write(fp) | 1505 ... c.write(fp) |
1506 >>> fp.seek(0) | 1506 >>> fp.seek(0) |
1507 >>> reversedpatch = fp.read() | 1507 >>> reversedpatch = fp.read() |
1508 >>> print reversedpatch | 1508 >>> print(pycompat.sysstr(reversedpatch)) |
1509 diff --git a/folder1/g b/folder1/g | 1509 diff --git a/folder1/g b/folder1/g |
1510 --- a/folder1/g | 1510 --- a/folder1/g |
1511 +++ b/folder1/g | 1511 +++ b/folder1/g |
1512 @@ -1,4 +1,3 @@ | 1512 @@ -1,4 +1,3 @@ |
1513 -firstline | 1513 -firstline |
1560 >>> headers = parsepatch([rawpatch], maxcontext=1) | 1560 >>> headers = parsepatch([rawpatch], maxcontext=1) |
1561 >>> for header in headers: | 1561 >>> for header in headers: |
1562 ... header.write(out) | 1562 ... header.write(out) |
1563 ... for hunk in header.hunks: | 1563 ... for hunk in header.hunks: |
1564 ... hunk.write(out) | 1564 ... hunk.write(out) |
1565 >>> print(out.getvalue()) | 1565 >>> print(pycompat.sysstr(out.getvalue())) |
1566 diff --git a/folder1/g b/folder1/g | 1566 diff --git a/folder1/g b/folder1/g |
1567 --- a/folder1/g | 1567 --- a/folder1/g |
1568 +++ b/folder1/g | 1568 +++ b/folder1/g |
1569 @@ -2,3 +2,2 @@ | 1569 @@ -2,3 +2,2 @@ |
1570 2 | 1570 2 |