Commits

Yuya Nishihara committed f21ca25

sign: use RepoAgent to run Mercurial command

Comments (0)

Files changed (2)

tortoisehg/hgqt/repowidget.py

     def signRevision(self):
         dlg = sign.SignDialog(self._repoagent, self.rev, self)
         dlg.showMessage.connect(self.showMessage)
-        dlg.output.connect(self.output)
         dlg.makeLogVisible.connect(self.makeLogVisible)
         dlg.exec_()
 

tortoisehg/hgqt/sign.py

 
 from tortoisehg.util import hglib
 from tortoisehg.hgqt.i18n import _
-from tortoisehg.hgqt import qtlib, cmdui
+from tortoisehg.hgqt import qtlib
 
 class SignDialog(QDialog):
     showMessage = pyqtSignal(QString)
-    output = pyqtSignal(QString, QString)
     makeLogVisible = pyqtSignal(bool)
 
     def __init__(self, repoagent, rev='tip', parent=None, opts={}):
         self.status.setContentsMargins(4, 2, 4, 4)
         self.layout().addWidget(self.status)
 
-        self.cmd = cmdui.Runner(False, self)
-        self.cmd.output.connect(self.output)
-        self.cmd.makeLogVisible.connect(self.makeLogVisible)
-        self.cmd.commandFinished.connect(self.commandFinished)
-
         # prepare to show
         self.setWindowTitle(_('Sign - %s') % repo.displayname)
         self.setWindowIcon(qtlib.geticon('hg-sign'))
     def commandFinished(self, ret):
         if ret == 0:
             self.set_status(_("Signature has been added"))
+        else:
+            self.makeLogVisible.emit(True)
 
     @pyqtSlot()
     def updateStates(self):
         self.customTextLineEdit.setEnabled(not nocommit and custom)
 
     def onSign(self):
-        if self.cmd.core.running():
+        if self._repoagent.isBusy():
             self.set_status(_('Repository command still running'), False)
             return
 
         if not user:
             return
 
-        cmd = ['sign', '--repository', self.repo.root, '--user', user]
+        cmd = ['sign', '--user', user]
 
         if key:
             cmd.append('--key=%s' % key)
                 cmd.append('--message=%s' % msg)
 
         cmd.append(str(self.rev))
-        self.cmd.run(cmd)
+        sess = self._repoagent.runCommand(map(hglib.tounicode, cmd), self)
+        sess.commandFinished.connect(self.commandFinished)
 
     def customMessageToggle(self, checked):
         self.customTextLineEdit.setEnabled(checked)