[Notes] [Git][BuildStream/buildstream][tlater/message-lines] widget.py: Avoid "showing 0 lines" messages when there are no lines



Title: GitLab

Tristan Maat pushed to branch tlater/message-lines at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/_frontend/widget.py
    ... ... @@ -647,8 +647,9 @@ class LogLine(Widget):
    647 647
                 abbrev = False
    
    648 648
                 if message.message_type not in ERROR_MESSAGES \
    
    649 649
                    and not frontend_message and n_lines > self._message_lines:
    
    650
    -                abbrev = True
    
    651 650
                     lines = lines[0:self._message_lines]
    
    651
    +                if self._message_lines > 0:
    
    652
    +                    abbrev = True
    
    652 653
                 else:
    
    653 654
                     lines[n_lines - 1] = lines[n_lines - 1].rstrip('\n')
    
    654 655
     
    
    ... ... @@ -674,7 +675,7 @@ class LogLine(Widget):
    674 675
                 if self.context is not None and not self.context.log_verbose:
    
    675 676
                     text += self._indent + self._err_profile.fmt("Log file: ")
    
    676 677
                     text += self._indent + self._logfile_widget.render(message) + '\n'
    
    677
    -            else:
    
    678
    +            elif self._log_lines > 0:
    
    678 679
                     text += self._indent + self._err_profile.fmt("Printing the last {} lines from log file:"
    
    679 680
                                                                  .format(self._log_lines)) + '\n'
    
    680 681
                     text += self._indent + self._logfile_widget.render(message, abbrev=False) + '\n'
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]