Source

thg-qt-mq / commit-mqenabled.diff

# HG changeset patch
# Parent cd86eedcab0fdeb087c3623007f9d415dcbee7fb
commit: allow to specify availability of mq for ease of automated test

diff --git a/tortoisehg/hgqt/commit.py b/tortoisehg/hgqt/commit.py
--- a/tortoisehg/hgqt/commit.py
+++ b/tortoisehg/hgqt/commit.py
@@ -42,7 +42,8 @@ class CommitWidget(QWidget, qtlib.TaskWi
     beginSuppressPrompt = pyqtSignal()
     endSuppressPrompt = pyqtSignal()
 
-    def __init__(self, repo, pats, opts, embedded=False, parent=None, rev=None):
+    def __init__(self, repo, pats, opts, embedded=False, parent=None, rev=None,
+                 mqenabled=None):
         QWidget.__init__(self, parent=parent)
 
         repo.configChanged.connect(self.configChanged)
@@ -156,8 +157,10 @@ class CommitWidget(QWidget, qtlib.TaskWi
         vbox.addLayout(hbox, 0)
         self.buttonHBox = hbox
 
-        if 'mq' in self.repo.extensions():
-            self.hasmqbutton = True
+        if mqenabled is None:
+            mqenabled = 'mq' in self.repo.extensions()
+        self.hasmqbutton = mqenabled
+        if self.hasmqbutton:
             pnhbox = QHBoxLayout()
             self.pnlabel = QLabel()
             pnhbox.addWidget(self.pnlabel)
@@ -166,8 +169,6 @@ class CommitWidget(QWidget, qtlib.TaskWi
             pnhbox.addWidget(self.pnedit)
             pnhbox.addStretch()
             vbox.addLayout(pnhbox)
-        else:
-            self.hasmqbutton = False
 
         class TruncLabel(QLabel):
             def __init__(self):