Commits

Yuya Nishihara committed 8c8b824

import for mod

Comments (0)

Files changed (4)

+# HG changeset patch
+# User Yuya Nishihara <yuya@tcha.org>
+# Date 1377338027 -32400
+#      Sat Aug 24 18:53:47 2013 +0900
+# Node ID 4d0796024aea4d648b230b0730a2da911db4bab1
+# Parent  c3b6264dba25e4053d67e4c32e985369e55a1abf
+qdelete: run Mercurial command by using RepoAgent
+
+- busycount and output signal are managed by RepoAgent
+- --repository is no longer necessary because --cwd is set by default
+
+diff --git a/tortoisehg/hgqt/qdelete.py b/tortoisehg/hgqt/qdelete.py
+--- a/tortoisehg/hgqt/qdelete.py
++++ b/tortoisehg/hgqt/qdelete.py
+@@ -14,7 +14,6 @@ from tortoisehg.hgqt.i18n import _
+ from tortoisehg.hgqt import cmdui
+ 
+ class QDeleteDialog(QDialog):
+-    output = pyqtSignal(QString, QString)
+     makeLogVisible = pyqtSignal(bool)
+ 
+     def __init__(self, repoagent, patches, parent):
+@@ -38,10 +37,6 @@ class QDeleteDialog(QDialog):
+         self.keepchk.setChecked(True)
+         self.layout().addWidget(self.keepchk)
+ 
+-        self.cmd = cmdui.Runner(False, self)
+-        self.cmd.output.connect(self.output)
+-        self.cmd.makeLogVisible.connect(self.makeLogVisible)
+-
+         BB = QDialogButtonBox
+         bbox = QDialogButtonBox(BB.Ok|BB.Cancel)
+         bbox.accepted.connect(self.accept)
+@@ -49,20 +44,16 @@ class QDeleteDialog(QDialog):
+         self.layout().addWidget(bbox)
+         self.bbox = bbox
+ 
+-    @property
+-    def repo(self):
+-        return self._repoagent.rawRepo()
+-
+     def accept(self):
+-        cmdline = ['qdelete', '--repository', self.repo.root]
++        cmdline = ['qdelete']
+         if self.keepchk.isChecked():
+             cmdline += ['--keep']
+-        cmdline += self.patches
+-        self.repo.incrementBusyCount()
+-        self.cmd.commandFinished.connect(self._finishOff)
+-        self.cmd.run(cmdline)
++        cmdline += map(hglib.tounicode, self.patches)
++        sess = self._repoagent.runCommand(cmdline, self)
++        sess.commandFinished.connect(self._finishOff)
+ 
+     @pyqtSlot(int)
+     def _finishOff(self, ret):
+-        self.repo.decrementBusyCount()
++        if ret != 0:
++            self.makeLogVisible.emit(True)
+         self.done(int(ret == 0))
+diff --git a/tortoisehg/hgqt/repowidget.py b/tortoisehg/hgqt/repowidget.py
+--- a/tortoisehg/hgqt/repowidget.py
++++ b/tortoisehg/hgqt/repowidget.py
+@@ -1602,7 +1602,6 @@ class RepoWidget(QWidget):
+             """Delete unapplied patch(es)"""
+             dlg = qdelete.QDeleteDialog(self._repoagent, self.menuselection,
+                                         self)
+-            dlg.output.connect(self.output)
+             dlg.makeLogVisible.connect(self.makeLogVisible)
+             dlg.exec_()
+         def qreorderact():
+# HG changeset patch
+# User Yuya Nishihara <yuya@tcha.org>
+# Date 1377435980 -32400
+#      Sun Aug 25 22:06:20 2013 +0900
+# Node ID a3a14d4a43671e8be38800858bac45c0be4fb21c
+# Parent  4d0796024aea4d648b230b0730a2da911db4bab1
+qdelete: use helper to build cmdline parameters
+
+diff --git a/tortoisehg/hgqt/qdelete.py b/tortoisehg/hgqt/qdelete.py
+--- a/tortoisehg/hgqt/qdelete.py
++++ b/tortoisehg/hgqt/qdelete.py
+@@ -45,10 +45,9 @@ class QDeleteDialog(QDialog):
+         self.bbox = bbox
+ 
+     def accept(self):
+-        cmdline = ['qdelete']
+-        if self.keepchk.isChecked():
+-            cmdline += ['--keep']
+-        cmdline += map(hglib.tounicode, self.patches)
++        upatches = map(hglib.tounicode, self.patches)
++        cmdline = hglib.buildcmdargs('qdelete', *upatches,
++                                     keep=self.keepchk.isChecked())
+         sess = self._repoagent.runCommand(cmdline, self)
+         sess.commandFinished.connect(self._finishOff)
+ 
+# HG changeset patch
+# User Yuya Nishihara <yuya@tcha.org>
+# Date 1377436400 -32400
+#      Sun Aug 25 22:13:20 2013 +0900
+# Node ID 9af4533f727f48302a05f568dc03c0b7cacd3abe
+# Parent  a3a14d4a43671e8be38800858bac45c0be4fb21c
+qdelete: simply accept patches parameter in unicode
+
+diff --git a/tortoisehg/hgqt/mq.py b/tortoisehg/hgqt/mq.py
+--- a/tortoisehg/hgqt/mq.py
++++ b/tortoisehg/hgqt/mq.py
+@@ -275,7 +275,7 @@ class MQPatchesWidget(QDockWidget):
+     @pyqtSlot()
+     def onDelete(self):
+         from tortoisehg.hgqt import qdelete
+-        patch = self.queueListWidget.currentItem()._thgpatch
++        patch = hglib.tounicode(self.queueListWidget.currentItem()._thgpatch)
+         dlg = qdelete.QDeleteDialog(self._repoagent, [patch], self)
+         if dlg.exec_() == QDialog.Accepted:
+             self.reload()
+diff --git a/tortoisehg/hgqt/qdelete.py b/tortoisehg/hgqt/qdelete.py
+--- a/tortoisehg/hgqt/qdelete.py
++++ b/tortoisehg/hgqt/qdelete.py
+@@ -29,7 +29,7 @@ class QDeleteDialog(QDialog):
+         self.setLayout(QVBoxLayout())
+ 
+         msg = _('Remove patches from queue?')
+-        patchesu = u'<li>'.join([hglib.tounicode(p) for p in patches])
++        patchesu = u'<li>'.join(self.patches)
+         lbl = QLabel(u'<b>%s<ul><li>%s</ul></b>' % (msg, patchesu))
+         self.layout().addWidget(lbl)
+ 
+@@ -45,8 +45,7 @@ class QDeleteDialog(QDialog):
+         self.bbox = bbox
+ 
+     def accept(self):
+-        upatches = map(hglib.tounicode, self.patches)
+-        cmdline = hglib.buildcmdargs('qdelete', *upatches,
++        cmdline = hglib.buildcmdargs('qdelete', *self.patches,
+                                      keep=self.keepchk.isChecked())
+         sess = self._repoagent.runCommand(cmdline, self)
+         sess.commandFinished.connect(self._finishOff)
+diff --git a/tortoisehg/hgqt/repowidget.py b/tortoisehg/hgqt/repowidget.py
+--- a/tortoisehg/hgqt/repowidget.py
++++ b/tortoisehg/hgqt/repowidget.py
+@@ -1600,8 +1600,8 @@ class RepoWidget(QWidget):
+     def generateUnappliedPatchMenu(self):
+         def qdeleteact():
+             """Delete unapplied patch(es)"""
+-            dlg = qdelete.QDeleteDialog(self._repoagent, self.menuselection,
+-                                        self)
++            patches = map(hglib.tounicode, self.menuselection)
++            dlg = qdelete.QDeleteDialog(self._repoagent, patches, self)
+             dlg.makeLogVisible.connect(self.makeLogVisible)
+             dlg.exec_()
+         def qreorderact():
+15119.diff
+15120.diff
+15121.diff
 cmdui-useagent.diff
 cmdcore-sessinit.diff
 cmdcore-sesspriv.diff