|
56 | 56 |
|
57 | 57 | p4_access_checked = False
|
58 | 58 |
|
59 |
| -re_ko_keywords = re.compile(r'\$(Id|Header)(:[^$\n]+)?\$') |
60 |
| -re_k_keywords = re.compile(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision)(:[^$\n]+)?\$') |
| 59 | +re_ko_keywords = re.compile(br'\$(Id|Header)(:[^$\n]+)?\$') |
| 60 | +re_k_keywords = re.compile(br'\$(Id|Header|Author|Date|DateTime|Change|File|Revision)(:[^$\n]+)?\$') |
61 | 61 |
|
62 | 62 | def p4_build_cmd(cmd):
|
63 | 63 | """Build a suitable p4 command line.
|
@@ -1754,9 +1754,9 @@ def patchRCSKeywords(self, file, regexp):
|
1754 | 1754 | # Attempt to zap the RCS keywords in a p4 controlled file matching the given regex
|
1755 | 1755 | (handle, outFileName) = tempfile.mkstemp(dir='.')
|
1756 | 1756 | try:
|
1757 |
| - with os.fdopen(handle, "w") as outFile, open(file, "r") as inFile: |
| 1757 | + with os.fdopen(handle, "wb") as outFile, open(file, "rb") as inFile: |
1758 | 1758 | for line in inFile.readlines():
|
1759 |
| - outFile.write(regexp.sub(r'$\1$', line)) |
| 1759 | + outFile.write(regexp.sub(br'$\1$', line)) |
1760 | 1760 | # Forcibly overwrite the original file
|
1761 | 1761 | os.unlink(file)
|
1762 | 1762 | shutil.move(outFileName, file)
|
@@ -2089,7 +2089,9 @@ def applyCommit(self, id):
|
2089 | 2089 | regexp = p4_keywords_regexp_for_file(file)
|
2090 | 2090 | if regexp:
|
2091 | 2091 | # this file is a possibility...look for RCS keywords.
|
2092 |
| - for line in read_pipe_lines(["git", "diff", "%s^..%s" % (id, id), file]): |
| 2092 | + for line in read_pipe_lines( |
| 2093 | + ["git", "diff", "%s^..%s" % (id, id), file], |
| 2094 | + raw=True): |
2093 | 2095 | if regexp.search(line):
|
2094 | 2096 | if verbose:
|
2095 | 2097 | print("got keyword match on %s in %s in %s" % (regex.pattern, line, file))
|
@@ -3020,8 +3022,7 @@ def streamOneP4File(self, file, contents):
|
3020 | 3022 | # even though in theory somebody may want that.
|
3021 | 3023 | regexp = p4_keywords_regexp_for_type(type_base, type_mods)
|
3022 | 3024 | if regexp:
|
3023 |
| - contents = [encode_text_stream(regexp.sub( |
3024 |
| - r'$\1$', ''.join(decode_text_stream(c) for c in contents)))] |
| 3025 | + contents = [regexp.sub(br'$\1$', c) for c in contents] |
3025 | 3026 |
|
3026 | 3027 | if self.largeFileSystem:
|
3027 | 3028 | (git_mode, contents) = self.largeFileSystem.processContent(git_mode, relPath, contents)
|
|
0 commit comments