@@ -138,7 +138,7 @@ def remote_ref(self):
138
138
@classmethod
139
139
def _from_line (cls , remote , line ):
140
140
"""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 """
142
142
control_character , from_to , summary = line .split ('\t ' , 3 )
143
143
flags = 0
144
144
@@ -522,6 +522,7 @@ def update(self, **kwargs):
522
522
523
523
def _get_fetch_info_from_stderr (self , proc , progress ):
524
524
# 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
525
526
output = IterableList ('name' )
526
527
527
528
# lines which are no progress are fetch info lines
@@ -544,8 +545,8 @@ def _get_fetch_info_from_stderr(self, proc, progress):
544
545
# END for each line
545
546
546
547
# 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 ()]
549
550
fp .close ()
550
551
551
552
# 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):
562
563
# we hope stdout can hold all the data, it should ...
563
564
# read the lines manually as it will use carriage returns between the messages
564
565
# 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
565
567
digest_process_messages (proc .stderr , progress )
566
568
567
569
output = IterableList ('name' )
568
570
for line in proc .stdout .readlines ():
571
+ line = line .decode (defenc )
569
572
try :
570
573
output .append (PushInfo ._from_line (self , line ))
571
574
except ValueError :
572
575
# if an error happens, additional info is given which we cannot parse
573
576
pass
574
577
# END exception handling
575
578
# END for each line
576
-
577
579
finalize_process (proc )
578
580
return output
579
581
0 commit comments