Commits

Yuya Nishihara committed fa7e26d

grep: fix parsing of history search result not to handle partial msg

Partial 'msg' can end with '\0' if 'before' line is empty at
mercurial/commands.py:grep()

ui.write(sep + before)
ui.write(match, label='grep.match')
ui.write(after)

  • Participants
  • Parent commits 5551fc5
  • Branches stable

Comments (0)

Files changed (1)

tortoisehg/hgqt/grep.py

             fullmsg = ''
             def write(self, msg, *args, **opts):
                 self.fullmsg += msg
-                if self.fullmsg.endswith('\0'):
+                if self.fullmsg.count('\0') >= 6:
                     try:
-                        fname, line, rev, addremove, user, text = \
-                                self.fullmsg.split('\0', 5)
+                        fname, line, rev, addremove, user, text, tail = \
+                                self.fullmsg.split('\0', 6)
                         text = hglib.tounicode(text)
                         text = Qt.escape(text)
                         text = '<b>%s</b> <span>%s</span>' % (
                         emitrow(row)
                     except ValueError:
                         pass
-                    self.fullmsg = ''
+                    self.fullmsg = tail
             def progress(topic, pos, item='', unit='', total=None):
                 emitprog(topic, pos, item, unit, total)
         cwd = os.getcwd()