diff src/mainwindow.cpp @ 691:5b3bcb2d0943

Update handling of auth extension load failures on Windows: hg itself is returning a successful error code, so we must check the output in the extension test phase. Also fix a failure & crash when trying to use fallback auth mechanism
author Chris Cannam
date Mon, 10 Dec 2018 12:03:04 +0000
parents 21e03596dd93
children 5074e870df22
line wrap: on
line diff
--- a/src/mainwindow.cpp	Mon Dec 10 10:28:25 2018 +0000
+++ b/src/mainwindow.cpp	Mon Dec 10 12:03:04 2018 +0000
@@ -81,8 +81,8 @@
     m_runner = new HgRunner(m_myDirPath, this);
     connect(m_runner, SIGNAL(commandStarting(HgAction)),
             this, SLOT(commandStarting(HgAction)));
-    connect(m_runner, SIGNAL(commandCompleted(HgAction, QString)),
-            this, SLOT(commandCompleted(HgAction, QString)));
+    connect(m_runner, SIGNAL(commandCompleted(HgAction, QString, QString)),
+            this, SLOT(commandCompleted(HgAction, QString, QString)));
     connect(m_runner, SIGNAL(commandFailed(HgAction, QString, QString)),
             this, SLOT(commandFailed(HgAction, QString, QString)));
     connect(m_runner, SIGNAL(commandCancelled(HgAction)),
@@ -2054,7 +2054,7 @@
     m_commandSequenceInProgress = true;
 }
 
-void MainWindow::commandFailed(HgAction action, QString stdErr, QString stdOut)
+void MainWindow::commandFailed(HgAction action, QString stdOut, QString stdErr)
 {
     DEBUG << "MainWindow::commandFailed" << endl;
 
@@ -2141,7 +2141,7 @@
         } else if (stdErr.contains("no changes found") || stdOut.contains("no changes found")) {
             // success: hg 2.1 starts returning failure code for empty pull/push
             m_commandSequenceInProgress = true; // there may be further commands
-            commandCompleted(action, stdOut);
+            commandCompleted(action, stdOut, stdErr);
             return;
         }
         break; // go on to default report
@@ -2158,7 +2158,7 @@
         } else if (stdErr.contains("no changes found") || stdOut.contains("no changes found")) {
             // success: hg 2.1 starts returning failure code for empty pull/push
             m_commandSequenceInProgress = true; // there may be further commands
-            commandCompleted(action, stdOut);
+            commandCompleted(action, stdOut, stdErr);
             return;
         }
         break; // go on to default report
@@ -2169,7 +2169,7 @@
         // succeeded, so that any further actions that are contingent
         // on the success of the heads query get carried out properly.
         m_commandSequenceInProgress = true; // there may be further commands
-        commandCompleted(action, "");
+        commandCompleted(action, "", "");
         return;
     case ACT_FOLDERDIFF:
     case ACT_CHGSETDIFF:
@@ -2218,7 +2218,7 @@
          stdErr);
 }
 
-void MainWindow::commandCompleted(HgAction completedAction, QString output)
+void MainWindow::commandCompleted(HgAction completedAction, QString output, QString stdErr)
 {
 //    std::cerr << "commandCompleted: " << completedAction.action << std::endl;
 
@@ -2254,6 +2254,10 @@
     }
 
     case ACT_TEST_HG_EXT:
+        if (stdErr.contains("Failed to load PyQt")) {
+            commandFailed(completedAction, output, stdErr);
+            return;
+        }
         break;
 
     case ACT_QUERY_PATHS:
@@ -2294,8 +2298,10 @@
             }
             output = winnowed.join("\n");
         }
+        /*
         DEBUG << "m_lastStatOutput = " << m_lastStatOutput << endl;
         DEBUG << "resolve output = " << output << endl;
+        */
         m_hgTabs->updateWorkFolderFileList(m_lastStatOutput + output);
         break;