mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo (python3): bytes() instead of chr() or string join
Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
ca5818056d
commit
4c05cbe072
@ -157,7 +157,8 @@ class PathQuoting:
|
|||||||
'"': '"',
|
'"': '"',
|
||||||
'\\':'\\'}
|
'\\':'\\'}
|
||||||
_unescape_re = re.compile(r'\\([a-z"\\]|[0-9]{3})')
|
_unescape_re = re.compile(r'\\([a-z"\\]|[0-9]{3})')
|
||||||
_escape = [chr(x) for x in range(127)]+['\\'+oct(x)[2:] for x in range(127,256)]
|
_escape = [bytes([x]) for x in range(127)]+[
|
||||||
|
'\\'+bytes(ord(c) for c in oct(x)[2:]) for x in range(127,256)]
|
||||||
_reverse = dict(map(reversed, _unescape.items()))
|
_reverse = dict(map(reversed, _unescape.items()))
|
||||||
for x in _reverse:
|
for x in _reverse:
|
||||||
_escape[ord(x)] = '\\'+_reverse[x]
|
_escape[ord(x)] = '\\'+_reverse[x]
|
||||||
@ -166,7 +167,7 @@ class PathQuoting:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def unescape_sequence(orig):
|
def unescape_sequence(orig):
|
||||||
seq = orig.group(1)
|
seq = orig.group(1)
|
||||||
return PathQuoting._unescape[seq] if len(seq) == 1 else chr(int(seq, 8))
|
return PathQuoting._unescape[seq] if len(seq) == 1 else bytes([int(seq, 8)])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dequote(quoted_string):
|
def dequote(quoted_string):
|
||||||
|
@ -34,7 +34,7 @@ class InterleaveRepositories:
|
|||||||
|
|
||||||
def weave_commit(self, commit):
|
def weave_commit(self, commit):
|
||||||
letter = re.match('Commit (.)', commit.message).group(1)
|
letter = re.match('Commit (.)', commit.message).group(1)
|
||||||
prev_letter = chr(ord(letter)-1)
|
prev_letter = bytes([ord(letter)-1])
|
||||||
|
|
||||||
# Splice in any extra commits needed
|
# Splice in any extra commits needed
|
||||||
if prev_letter in self.commit_map:
|
if prev_letter in self.commit_map:
|
||||||
|
@ -21,7 +21,7 @@ import textwrap
|
|||||||
import git_filter_repo as fr
|
import git_filter_repo as fr
|
||||||
|
|
||||||
def handle_progress(progress):
|
def handle_progress(progress):
|
||||||
print("Decipher this: "+''.join(reversed(progress.message)))
|
print("Decipher this: "+bytes(reversed(progress.message)))
|
||||||
|
|
||||||
def handle_checkpoint(checkpoint_object):
|
def handle_checkpoint(checkpoint_object):
|
||||||
# Flip a coin; see if we want to pass the checkpoint through.
|
# Flip a coin; see if we want to pass the checkpoint through.
|
||||||
|
Loading…
Reference in New Issue
Block a user