Re: RBTools Ticket #4825: rbt diff fails for git-p4 repo with Python 3.7.2 on Windows.

3 views
Skip to first unread message

Ben Jackson

unread,
Dec 3, 2019, 12:11:44 PM12/3/19
to Aleksei Bavshin, Ben Jackson, reviewboa...@googlegroups.com
To reply, visit https://hellosplat.com/s/beanbag/tickets/4825/

New update by puremourning

For Beanbag, Inc. RBTools Ticket #4825

How about this patch ?

commit ad51dadc52685520293a0ed226b95649b4104298
Author: Ben Jackson <ben.j...@fidessa.com>
Date:   Wed Apr 24 10:16:37 2019 +0100

    Fix unicode errors

diff --git a/rbtools/clients/git.py b/rbtools/clients/git.py
index 142e547..cd4d459 100644
--- a/rbtools/clients/git.py
+++ b/rbtools/clients/git.py
@@ -925,7 +925,9 @@ class GitClient(SCMClient):
         p4rev = b''

         # Find which depot changelist we're based on
-        log = self._execute([self.git, 'log', merge_base], ignore_errors=True)
+        log = self._execute([self.git, 'log', merge_base],
+                            ignore_errors=True,
+                            results_unicode=False)

         for line in log:
             m = re.search(br'[rd]epo.-paths = "(.+)": change = (\d+).*\]',
@@ -952,23 +954,24 @@ class GitClient(SCMClient):
             elif (line.startswith(b'--- ') and i + 1 < len(diff_lines) and
                   diff_lines[i + 1].startswith(b'+++ ')):
                 data = self._execute(
-                    ['p4', 'files', base_path + filename + '@' + p4rev],
-                    ignore_errors=True, results_unicode=False)
+                    [b'p4', b'files', base_path + filename + b'@' + p4rev],
+                    ignore_errors=True,
+                    results_unicode=False)
                 m = re.search(br'^%s%s#(\d+).*$' % (re.escape(base_path),
                                                     re.escape(filename)),
                               data, re.M)
                 if m:
                     file_version = m.group(1).strip()
                 else:
-                    file_version = 1
+                    file_version = b'1'

-                diff_data += b'--- %s%s\t%s%s#%s\n' % (base_path, filename,
+                diff_data += ( b'--- %s%s\t%s%s#%s\n' % (base_path, filename,
                                                        base_path, filename,
-                                                       file_version)
+                                                       file_version) )
             elif line.startswith(b'+++ '):
                 # TODO: add a real timestamp
-                diff_data += b'+++ %s%s\t%s\n' % (base_path, filename,
-                                                  b'TIMESTAMP')
+                diff_data += ( b'+++ %s%s\t%s\n' % (base_path, filename,
+                                                  b'TIMESTAMP') )
             else:
                 diff_data += line

works for me...

Reply all
Reply to author
Forward
0 new messages