Mercurial > hg > easyhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
690:bfafe078df9a | 691:5b3bcb2d0943 |
---|---|
79 createStatusBar(); | 79 createStatusBar(); |
80 | 80 |
81 m_runner = new HgRunner(m_myDirPath, this); | 81 m_runner = new HgRunner(m_myDirPath, this); |
82 connect(m_runner, SIGNAL(commandStarting(HgAction)), | 82 connect(m_runner, SIGNAL(commandStarting(HgAction)), |
83 this, SLOT(commandStarting(HgAction))); | 83 this, SLOT(commandStarting(HgAction))); |
84 connect(m_runner, SIGNAL(commandCompleted(HgAction, QString)), | 84 connect(m_runner, SIGNAL(commandCompleted(HgAction, QString, QString)), |
85 this, SLOT(commandCompleted(HgAction, QString))); | 85 this, SLOT(commandCompleted(HgAction, QString, QString))); |
86 connect(m_runner, SIGNAL(commandFailed(HgAction, QString, QString)), | 86 connect(m_runner, SIGNAL(commandFailed(HgAction, QString, QString)), |
87 this, SLOT(commandFailed(HgAction, QString, QString))); | 87 this, SLOT(commandFailed(HgAction, QString, QString))); |
88 connect(m_runner, SIGNAL(commandCancelled(HgAction)), | 88 connect(m_runner, SIGNAL(commandCancelled(HgAction)), |
89 this, SLOT(commandCancelled(HgAction))); | 89 this, SLOT(commandCancelled(HgAction))); |
90 statusBar()->addPermanentWidget(m_runner); | 90 statusBar()->addPermanentWidget(m_runner); |
2052 void MainWindow::commandStarting(HgAction) | 2052 void MainWindow::commandStarting(HgAction) |
2053 { | 2053 { |
2054 m_commandSequenceInProgress = true; | 2054 m_commandSequenceInProgress = true; |
2055 } | 2055 } |
2056 | 2056 |
2057 void MainWindow::commandFailed(HgAction action, QString stdErr, QString stdOut) | 2057 void MainWindow::commandFailed(HgAction action, QString stdOut, QString stdErr) |
2058 { | 2058 { |
2059 DEBUG << "MainWindow::commandFailed" << endl; | 2059 DEBUG << "MainWindow::commandFailed" << endl; |
2060 | 2060 |
2061 m_commandSequenceInProgress = false; | 2061 m_commandSequenceInProgress = false; |
2062 | 2062 |
2139 // ignore this, user cancelled username or password dialog | 2139 // ignore this, user cancelled username or password dialog |
2140 return; | 2140 return; |
2141 } else if (stdErr.contains("no changes found") || stdOut.contains("no changes found")) { | 2141 } else if (stdErr.contains("no changes found") || stdOut.contains("no changes found")) { |
2142 // success: hg 2.1 starts returning failure code for empty pull/push | 2142 // success: hg 2.1 starts returning failure code for empty pull/push |
2143 m_commandSequenceInProgress = true; // there may be further commands | 2143 m_commandSequenceInProgress = true; // there may be further commands |
2144 commandCompleted(action, stdOut); | 2144 commandCompleted(action, stdOut, stdErr); |
2145 return; | 2145 return; |
2146 } | 2146 } |
2147 break; // go on to default report | 2147 break; // go on to default report |
2148 case ACT_PUSH: | 2148 case ACT_PUSH: |
2149 if (stdErr.contains("creates new remote head")) { | 2149 if (stdErr.contains("creates new remote head")) { |
2156 // ignore this, user cancelled username or password dialog | 2156 // ignore this, user cancelled username or password dialog |
2157 return; | 2157 return; |
2158 } else if (stdErr.contains("no changes found") || stdOut.contains("no changes found")) { | 2158 } else if (stdErr.contains("no changes found") || stdOut.contains("no changes found")) { |
2159 // success: hg 2.1 starts returning failure code for empty pull/push | 2159 // success: hg 2.1 starts returning failure code for empty pull/push |
2160 m_commandSequenceInProgress = true; // there may be further commands | 2160 m_commandSequenceInProgress = true; // there may be further commands |
2161 commandCompleted(action, stdOut); | 2161 commandCompleted(action, stdOut, stdErr); |
2162 return; | 2162 return; |
2163 } | 2163 } |
2164 break; // go on to default report | 2164 break; // go on to default report |
2165 case ACT_QUERY_HEADS_ACTIVE: | 2165 case ACT_QUERY_HEADS_ACTIVE: |
2166 case ACT_QUERY_HEADS: | 2166 case ACT_QUERY_HEADS: |
2167 // fails if repo is empty; we don't care (if there's a genuine | 2167 // fails if repo is empty; we don't care (if there's a genuine |
2168 // problem, something else will fail too). Pretend it | 2168 // problem, something else will fail too). Pretend it |
2169 // succeeded, so that any further actions that are contingent | 2169 // succeeded, so that any further actions that are contingent |
2170 // on the success of the heads query get carried out properly. | 2170 // on the success of the heads query get carried out properly. |
2171 m_commandSequenceInProgress = true; // there may be further commands | 2171 m_commandSequenceInProgress = true; // there may be further commands |
2172 commandCompleted(action, ""); | 2172 commandCompleted(action, "", ""); |
2173 return; | 2173 return; |
2174 case ACT_FOLDERDIFF: | 2174 case ACT_FOLDERDIFF: |
2175 case ACT_CHGSETDIFF: | 2175 case ACT_CHGSETDIFF: |
2176 // external program, unlikely to be anything useful in stdErr | 2176 // external program, unlikely to be anything useful in stdErr |
2177 // and some return with failure codes when something as basic | 2177 // and some return with failure codes when something as basic |
2216 tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.") : | 2216 tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.") : |
2217 tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.<br><br>See “More Details” for the command output.")), | 2217 tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.<br><br>See “More Details” for the command output.")), |
2218 stdErr); | 2218 stdErr); |
2219 } | 2219 } |
2220 | 2220 |
2221 void MainWindow::commandCompleted(HgAction completedAction, QString output) | 2221 void MainWindow::commandCompleted(HgAction completedAction, QString output, QString stdErr) |
2222 { | 2222 { |
2223 // std::cerr << "commandCompleted: " << completedAction.action << std::endl; | 2223 // std::cerr << "commandCompleted: " << completedAction.action << std::endl; |
2224 | 2224 |
2225 HGACTIONS action = completedAction.action; | 2225 HGACTIONS action = completedAction.action; |
2226 | 2226 |
2252 } | 2252 } |
2253 break; | 2253 break; |
2254 } | 2254 } |
2255 | 2255 |
2256 case ACT_TEST_HG_EXT: | 2256 case ACT_TEST_HG_EXT: |
2257 if (stdErr.contains("Failed to load PyQt")) { | |
2258 commandFailed(completedAction, output, stdErr); | |
2259 return; | |
2260 } | |
2257 break; | 2261 break; |
2258 | 2262 |
2259 case ACT_QUERY_PATHS: | 2263 case ACT_QUERY_PATHS: |
2260 { | 2264 { |
2261 DEBUG << "stdout is " << output << endl; | 2265 DEBUG << "stdout is " << output << endl; |
2292 foreach (QString line, outList) { | 2296 foreach (QString line, outList) { |
2293 if (!line.startsWith("R ")) winnowed.push_back(line); | 2297 if (!line.startsWith("R ")) winnowed.push_back(line); |
2294 } | 2298 } |
2295 output = winnowed.join("\n"); | 2299 output = winnowed.join("\n"); |
2296 } | 2300 } |
2301 /* | |
2297 DEBUG << "m_lastStatOutput = " << m_lastStatOutput << endl; | 2302 DEBUG << "m_lastStatOutput = " << m_lastStatOutput << endl; |
2298 DEBUG << "resolve output = " << output << endl; | 2303 DEBUG << "resolve output = " << output << endl; |
2304 */ | |
2299 m_hgTabs->updateWorkFolderFileList(m_lastStatOutput + output); | 2305 m_hgTabs->updateWorkFolderFileList(m_lastStatOutput + output); |
2300 break; | 2306 break; |
2301 | 2307 |
2302 case ACT_RESOLVE_MARK: | 2308 case ACT_RESOLVE_MARK: |
2303 m_shouldHgStat = true; | 2309 m_shouldHgStat = true; |