Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 34146: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 | 8b8b70cb4288 |
children | a8994d08e4a2 |
line wrap: on
line diff
--- a/mercurial/patch.py Thu Sep 07 22:36:54 2017 +0900 +++ b/mercurial/patch.py Sun Sep 03 14:32:11 2017 +0900 @@ -1479,7 +1479,7 @@ This function operates on hunks coming out of patch.filterpatch, that is a list of the form: [header1, hunk1, hunk2, header2...]. Example usage: - >>> rawpatch = """diff --git a/folder1/g b/folder1/g + >>> rawpatch = b"""diff --git a/folder1/g b/folder1/g ... --- a/folder1/g ... +++ b/folder1/g ... @@ -1,7 +1,7 @@ @@ -1541,7 +1541,7 @@ If maxcontext is not None, trim context lines if necessary. - >>> rawpatch = '''diff --git a/folder1/g b/folder1/g + >>> rawpatch = b'''diff --git a/folder1/g b/folder1/g ... --- a/folder1/g ... +++ b/folder1/g ... @@ -1,8 +1,10 @@ @@ -1667,17 +1667,17 @@ Returns (stripped components, path in repository). - >>> pathtransform('a/b/c', 0, '') + >>> pathtransform(b'a/b/c', 0, b'') ('', 'a/b/c') - >>> pathtransform(' a/b/c ', 0, '') + >>> pathtransform(b' a/b/c ', 0, b'') ('', ' a/b/c') - >>> pathtransform(' a/b/c ', 2, '') + >>> pathtransform(b' a/b/c ', 2, b'') ('a/b/', 'c') - >>> pathtransform('a/b/c', 0, 'd/e/') + >>> pathtransform(b'a/b/c', 0, b'd/e/') ('', 'd/e/a/b/c') - >>> pathtransform(' a//b/c ', 2, 'd/e/') + >>> pathtransform(b' a//b/c ', 2, b'd/e/') ('a//b/', 'd/e/c') - >>> pathtransform('a/b/c', 3, '') + >>> pathtransform(b'a/b/c', 3, b'') Traceback (most recent call last): PatchError: unable to strip away 1 of 3 dirs from a/b/c '''