Commits

Yuya Nishihara committed e603007

cmdcore: extract helper to emit command banner

  • Participants
  • Parent commits ebc6201

Comments (0)

Files changed (1)

File tortoisehg/hgqt/cmdcore.py

         worker.progressReceived.disconnect(self.progressReceived)
         self._worker = None
 
+    def _emitControlMessage(self, msg):
+        self.outputReceived.emit(msg + '\n', 'control')
+
     def _runNext(self):
         cmdline = self._queue[self._qnextp]
         self._qnextp += 1
         del self._erroroutputs[:]
         del self._warningoutputs[:]
         self._worker.startCommand(cmdline)
-        msg = '%% hg %s\n' % _prettifycmdline(cmdline)
-        self.outputReceived.emit(msg, 'control')
+        self._emitControlMessage('% hg ' + _prettifycmdline(cmdline))
 
     def _finish(self, ret):
         self._qnextp = len(self._queue)
             msg = _('[command returned code %d %%s]') % ret
         else:
             msg = _('[command completed successfully %s]')
-        self.outputReceived.emit(msg % time.asctime() + '\n', 'control')
+        self._emitControlMessage(msg % time.asctime())
 
         if ret != 0 or self._qnextp >= len(self._queue):
             self._finish(ret)