changeset 200:8c8c04bdf0fa

* Separate out the hg test action into two tests, one for plain hg and one with the extension (so can report separately)
author Chris Cannam
date Tue, 04 Jan 2011 12:42:28 +0000
parents f16fe0db11f3
children 0844b4d8d911 3d4291d4226c
files hgaction.h mainwindow.cpp mainwindow.h
diffstat 3 files changed, 28 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgaction.h	Mon Jan 03 22:02:08 2011 +0000
+++ b/hgaction.h	Tue Jan 04 12:42:28 2011 +0000
@@ -25,6 +25,7 @@
 {
     ACT_NONE,
     ACT_TEST_HG,
+    ACT_TEST_HG_EXT,
     ACT_QUERY_PATHS,
     ACT_QUERY_BRANCH,
     ACT_STAT,
@@ -75,6 +76,8 @@
     bool shouldBeFast() const {
         switch (action) {
         case ACT_NONE:
+        case ACT_TEST_HG:
+        case ACT_TEST_HG_EXT:
         case ACT_QUERY_PATHS:
         case ACT_QUERY_BRANCH:
         case ACT_STAT:
@@ -90,7 +93,7 @@
     
     bool mayBeInteractive() const {
 	switch (action) {
-        case ACT_TEST_HG: // so we force the module load to be tested
+        case ACT_TEST_HG_EXT: // so we force the module load to be tested
 	case ACT_INCOMING:
 	case ACT_PUSH:
 	case ACT_PULL:
--- a/mainwindow.cpp	Mon Jan 03 22:02:08 2011 +0000
+++ b/mainwindow.cpp	Tue Jan 04 12:42:28 2011 +0000
@@ -194,6 +194,13 @@
     runner->requestAction(HgAction(ACT_TEST_HG, m_myDirPath, params));
 }
 
+void MainWindow::hgTestExtension()
+{
+    QStringList params;
+    params << "--version";
+    runner->requestAction(HgAction(ACT_TEST_HG_EXT, m_myDirPath, params));
+}
+
 void MainWindow::hgStat()
 {
     QStringList params;
@@ -1487,7 +1494,15 @@
         QMessageBox::warning
             (this, tr("Failed to run Mercurial"),
              format3(tr("Failed to run Mercurial"),
-                     tr("The Mercurial program either could not be found or failed to run.<br>This may indicate a problem with the Mercurial installation, or with the EasyHg interaction extension.<br><br>%1").arg(output == "" ? QString("") : tr("The test command said:")),
+                     tr("The Mercurial program either could not be found or failed to run.<br>Check that the Mercurial program path is correct in Settings.<br><br>%1").arg(output == "" ? QString("") : tr("The test command said:")),
+                     output));
+        settings();
+        return;
+    case ACT_TEST_HG_EXT:
+        QMessageBox::warning
+            (this, tr("Failed to run Mercurial"),
+             format3(tr("Failed to run Mercurial with extension enabled"),
+                     tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.<br>This may indicate an installation problem with EasyMercurial.<br><br>You may be able to continue working if you switch off &ldquo;Use EasyHg Mercurial Extension&rdquo; in Settings.  Note that remote repositories that require authentication may not work if you do this.<br><br>%1").arg(output == "" ? QString("") : tr("The test command said:")),
                      output));
         settings();
         return;
@@ -1555,6 +1570,9 @@
     case ACT_TEST_HG:
         break;
 
+    case ACT_TEST_HG_EXT:
+        break;
+
     case ACT_QUERY_PATHS:
     {
         DEBUG << "stdout is " << output << endl;
@@ -1741,6 +1759,10 @@
     switch (action) {
 
     case ACT_TEST_HG:
+        hgTestExtension();
+        break;
+        
+    case ACT_TEST_HG_EXT:
         hgQueryPaths();
         break;
         
--- a/mainwindow.h	Mon Jan 03 22:02:08 2011 +0000
+++ b/mainwindow.h	Tue Jan 04 12:42:28 2011 +0000
@@ -74,6 +74,7 @@
     void showAllChanged(bool);
 
     void hgTest();
+    void hgTestExtension();
     void hgQueryPaths();
     void hgStat();
     void hgRemove();