Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19099f9

Browse files
committed
Python 3 compat fixes
Specifically "string_escape" does not exist as an encoding anymore.
1 parent7fbc182 commit19099f9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎git/diff.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ def decode_path(path, has_ab_prefix=True):
2727
returnNone
2828

2929
ifpath.startswith(b'"')andpath.endswith(b'"'):
30-
path=path[1:-1].decode('string_escape')
30+
path= (path[1:-1].replace(b'\\n',b'\n')
31+
.replace(b'\\t',b'\t')
32+
.replace(b'\\"',b'"')
33+
.replace(b'\\\\',b'\\'))
3134

3235
ifhas_ab_prefix:
3336
assertpath.startswith(b'a/')orpath.startswith(b'b/')

‎git/test/test_diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_diff_unsafe_paths(self):
158158
self.assertEqual(res[5].b_path,u'path/with\nnewline')
159159
self.assertEqual(res[6].b_path,u'path/with spaces')
160160
self.assertEqual(res[7].b_path,u'path/with-question-mark?')
161-
self.assertEqual(res[8].b_path,ur'path/¯\_(ツ)_|¯')
161+
self.assertEqual(res[8].b_path,u'path/¯\\_(ツ)_|¯')
162162

163163
# The "Moves"
164164
# NOTE: The path prefixes a/ and b/ here are legit! We're actually

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp