Beispiel #1
0
    def run(self):
        ui = QtUi(responseq=self.responseq)
        ui.sig.writeSignal.connect(self.output_handler,
                Qt.QueuedConnection)
        ui.sig.progressSignal.connect(self.progress_handler,
                Qt.QueuedConnection)
        ui.sig.interactSignal.connect(self.interact_handler,
                Qt.QueuedConnection)

        if self.display:
            cmd = '%% hg %s\n' % self.display
        else:
            cmd = '%% hg %s\n' % ' '.join(self.cmdline)
        ui.write(cmd, label='control')

        try:
            # save thread id in order to terminate by KeyboardInterrupt
            self.thread_id = int(QThread.currentThreadId())

            for k, v in ui.configitems('defaults'):
                ui.setconfig('defaults', k, '')
            self.ret = 255
            self.ret = hglib.dispatch(ui, self.cmdline) or 0
        except util.Abort, e:
            ui.write_err(local._('abort: ') + str(e) + '\n')
            if e.hint:
                ui.write_err(local._('hint: ') + str(e.hint) + '\n')
Beispiel #2
0
    def run(self):
        ui = QtUi(responseq=self.responseq)
        ui.sig.writeSignal.connect(self.output_handler,
                Qt.QueuedConnection)
        ui.sig.progressSignal.connect(self.progress_handler,
                Qt.QueuedConnection)
        ui.sig.interactSignal.connect(self.interact_handler,
                Qt.QueuedConnection)

        try:
            # save thread id in order to terminate by KeyboardInterrupt
            self.thread_id = int(QThread.currentThreadId())

            for k, v in ui.configitems('defaults'):
                ui.setconfig('defaults', k, '')
            # disable worker because it only works in main thread:
            #   signal.signal(signal.SIGINT, signal.SIG_IGN)
            #   ValueError: signal only works in main thread
            ui.setconfig('worker', 'numcpus', 1)
            self.ret = 255
            self.ret = hglib.dispatch(ui, self.cmdline) or 0
        except subrepo.SubrepoAbort, e:
            errormsg = str(e)
            label = 'ui.error'
            if e.subrepo:
                label += ' subrepo=%s' % urllib.quote(e.subrepo)
            ui.write_err(local._('abort: ') + errormsg + '\n', label=label)
            if e.hint:
                ui.write_err(local._('hint: ') + str(e.hint) + '\n', label=label)
Beispiel #3
0
    def run(self):
        ui = QtUi(responseq=self.responseq)
        ui.sig.writeSignal.connect(self.output_handler, Qt.QueuedConnection)
        ui.sig.progressSignal.connect(self.progress_handler,
                                      Qt.QueuedConnection)
        ui.sig.interactSignal.connect(self.interact_handler,
                                      Qt.QueuedConnection)

        if self.display:
            cmd = '%% hg %s\n' % self.display
        else:
            cmd = '%% hg %s\n' % ' '.join(self.cmdline)
        ui.write(cmd, label='control')

        try:
            # save thread id in order to terminate by KeyboardInterrupt
            self.thread_id = int(QThread.currentThreadId())

            for k, v in ui.configitems('defaults'):
                ui.setconfig('defaults', k, '')
            self.ret = 255
            self.ret = hglib.dispatch(ui, self.cmdline) or 0
        except util.Abort, e:
            ui.write_err(local._('abort: ') + str(e) + '\n')
            if e.hint:
                ui.write_err(local._('hint: ') + str(e.hint) + '\n')
Beispiel #4
0
    def run(self):
        ui = QtUi(responseq=self.responseq)
        ui.sig.writeSignal.connect(self.output_handler, Qt.QueuedConnection)
        ui.sig.progressSignal.connect(self.progress_handler,
                                      Qt.QueuedConnection)
        ui.sig.interactSignal.connect(self.interact_handler,
                                      Qt.QueuedConnection)

        try:
            # save thread id in order to terminate by KeyboardInterrupt
            self.thread_id = int(QThread.currentThreadId())

            for k, v in ui.configitems('defaults'):
                ui.setconfig('defaults', k, '')
            # disable worker because it only works in main thread:
            #   signal.signal(signal.SIGINT, signal.SIG_IGN)
            #   ValueError: signal only works in main thread
            ui.setconfig('worker', 'numcpus', 1)
            self.ret = 255
            self.ret = hglib.dispatch(ui, self.cmdline) or 0
        except subrepo.SubrepoAbort, e:
            errormsg = str(e)
            label = 'ui.error'
            if e.subrepo:
                label += ' subrepo=%s' % urllib.quote(e.subrepo)
            ui.write_err(local._('abort: ') + errormsg + '\n', label=label)
            if e.hint:
                ui.write_err(local._('hint: ') + str(e.hint) + '\n',
                             label=label)
Beispiel #5
0
 def run(self):
     try:
         for k, v in self.ui.configitems('defaults'):
             self.ui.setconfig('defaults', k, '')
         l = 'control'
         ret = hglib.dispatch(self.ui, self.args)
         if ret:
             self.ui.write(_('[command returned code %d ') % int(ret), label=l)
         else:
             self.ui.write(_('[command completed successfully '), label=l)
         self.ui.write(time.asctime() + ']\n', label=l)
         self.ret = ret or 0
         if self.postfunc:
             self.postfunc(ret)
     except util.Abort, e:
         self.ui.write_err(_('abort: ') + str(e) + '\n')