Mercurial > hg
comparison hgext/convert/p4.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 | 78ac8acfc4bd |
children | b1d94bc61c79 |
comparison
equal
deleted
inserted
replaced
34130:ada8a19672ab | 34131:0fa781320203 |
---|---|
30 | 30 |
31 def decodefilename(filename): | 31 def decodefilename(filename): |
32 """Perforce escapes special characters @, #, *, or % | 32 """Perforce escapes special characters @, #, *, or % |
33 with %40, %23, %2A, or %25 respectively | 33 with %40, %23, %2A, or %25 respectively |
34 | 34 |
35 >>> decodefilename('portable-net45%252Bnetcore45%252Bwp8%252BMonoAndroid') | 35 >>> decodefilename(b'portable-net45%252Bnetcore45%252Bwp8%252BMonoAndroid') |
36 'portable-net45%2Bnetcore45%2Bwp8%2BMonoAndroid' | 36 'portable-net45%2Bnetcore45%2Bwp8%2BMonoAndroid' |
37 >>> decodefilename('//Depot/Directory/%2525/%2523/%23%40.%2A') | 37 >>> decodefilename(b'//Depot/Directory/%2525/%2523/%23%40.%2A') |
38 '//Depot/Directory/%25/%23/#@.*' | 38 '//Depot/Directory/%25/%23/#@.*' |
39 """ | 39 """ |
40 replacements = [('%2A', '*'), ('%23', '#'), ('%40', '@'), ('%25', '%')] | 40 replacements = [('%2A', '*'), ('%23', '#'), ('%40', '@'), ('%25', '%')] |
41 for k, v in replacements: | 41 for k, v in replacements: |
42 filename = filename.replace(k, v) | 42 filename = filename.replace(k, v) |