@@ -138,7 +138,7 @@ def remote_ref(self):
138138 @classmethod
139139 def _from_line (cls , remote , line ):
140140 """Create a new PushInfo instance as parsed from line which is expected to be like
141- refs/heads/master:refs/heads/master 05d2687..1d0568e"""
141+ refs/heads/master:refs/heads/master 05d2687..1d0568e as bytes """
142142 control_character , from_to , summary = line .split ('\t ' , 3 )
143143 flags = 0
144144
@@ -522,6 +522,7 @@ def update(self, **kwargs):
522522
523523 def _get_fetch_info_from_stderr (self , proc , progress ):
524524 # skip first line as it is some remote info we are not interested in
525+ # TODO: Use poll() to process stdout and stderr at same time
525526 output = IterableList ('name' )
526527
527528 # lines which are no progress are fetch info lines
@@ -544,8 +545,8 @@ def _get_fetch_info_from_stderr(self, proc, progress):
544545 # END for each line
545546
546547 # read head information
547- fp = open (join (self .repo .git_dir , 'FETCH_HEAD' ), 'r ' )
548- fetch_head_info = fp .readlines ()
548+ fp = open (join (self .repo .git_dir , 'FETCH_HEAD' ), 'rb ' )
549+ fetch_head_info = [ l . decode ( defenc ) for l in fp .readlines ()]
549550 fp .close ()
550551
551552 # NOTE: We assume to fetch at least enough progress lines to allow matching each fetch head line with it.
@@ -562,18 +563,19 @@ def _get_push_info(self, proc, progress):
562563 # we hope stdout can hold all the data, it should ...
563564 # read the lines manually as it will use carriage returns between the messages
564565 # to override the previous one. This is why we read the bytes manually
566+ # TODO: poll() on file descriptors to know what to read next, process streams concurrently
565567 digest_process_messages (proc .stderr , progress )
566568
567569 output = IterableList ('name' )
568570 for line in proc .stdout .readlines ():
571+ line = line .decode (defenc )
569572 try :
570573 output .append (PushInfo ._from_line (self , line ))
571574 except ValueError :
572575 # if an error happens, additional info is given which we cannot parse
573576 pass
574577 # END exception handling
575578 # END for each line
576-
577579 finalize_process (proc )
578580 return output
579581
0 commit comments