Mercurial > hg > easyhg
comparison src/mainwindow.cpp @ 545:3944da037ab8 fswatcher
stderr -> stdErr to avoid name conflicts with possible stderr macro in system headers
author | Chris Cannam |
---|---|
date | Tue, 14 Feb 2012 17:41:43 +0000 |
parents | bb98b65b23c9 |
children | 4edb47f8c3a3 |
comparison
equal
deleted
inserted
replaced
544:bb98b65b23c9 | 545:3944da037ab8 |
---|---|
1981 void MainWindow::commandStarting(HgAction action) | 1981 void MainWindow::commandStarting(HgAction action) |
1982 { | 1982 { |
1983 m_commandSequenceInProgress = true; | 1983 m_commandSequenceInProgress = true; |
1984 } | 1984 } |
1985 | 1985 |
1986 void MainWindow::commandFailed(HgAction action, QString stderr, QString stdout) | 1986 void MainWindow::commandFailed(HgAction action, QString stdErr, QString stdout) |
1987 { | 1987 { |
1988 DEBUG << "MainWindow::commandFailed" << endl; | 1988 DEBUG << "MainWindow::commandFailed" << endl; |
1989 | 1989 |
1990 m_commandSequenceInProgress = false; | 1990 m_commandSequenceInProgress = false; |
1991 | 1991 |
2013 MoreInformationDialog::warning | 2013 MoreInformationDialog::warning |
2014 (this, | 2014 (this, |
2015 tr("Failed to run Mercurial"), | 2015 tr("Failed to run Mercurial"), |
2016 tr("Failed to run Mercurial"), | 2016 tr("Failed to run Mercurial"), |
2017 tr("The Mercurial program either could not be found or failed to run.<br><br>Check that the Mercurial program path is correct in %1.").arg(setstr), | 2017 tr("The Mercurial program either could not be found or failed to run.<br><br>Check that the Mercurial program path is correct in %1.").arg(setstr), |
2018 stderr); | 2018 stdErr); |
2019 settings(SettingsDialog::PathsTab); | 2019 settings(SettingsDialog::PathsTab); |
2020 return; | 2020 return; |
2021 case ACT_TEST_HG_EXT: | 2021 case ACT_TEST_HG_EXT: |
2022 MoreInformationDialog::warning | 2022 MoreInformationDialog::warning |
2023 (this, | 2023 (this, |
2024 tr("Failed to run Mercurial"), | 2024 tr("Failed to run Mercurial"), |
2025 tr("Failed to run Mercurial with extension enabled"), | 2025 tr("Failed to run Mercurial with extension enabled"), |
2026 tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.<br>This may indicate an installation problem.<br><br>You may be able to continue working if you switch off “Use EasyHg Mercurial Extension” in %1. Note that remote repositories that require authentication might not work if you do this.").arg(setstr), | 2026 tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.<br>This may indicate an installation problem.<br><br>You may be able to continue working if you switch off “Use EasyHg Mercurial Extension” in %1. Note that remote repositories that require authentication might not work if you do this.").arg(setstr), |
2027 stderr); | 2027 stdErr); |
2028 settings(SettingsDialog::PathsTab); | 2028 settings(SettingsDialog::PathsTab); |
2029 return; | 2029 return; |
2030 case ACT_CLONEFROMREMOTE: | 2030 case ACT_CLONEFROMREMOTE: |
2031 // if clone fails, we have no repo | 2031 // if clone fails, we have no repo |
2032 m_workFolderPath = ""; | 2032 m_workFolderPath = ""; |
2033 enableDisableActions(); | 2033 enableDisableActions(); |
2034 break; // go on to default report | 2034 break; // go on to default report |
2035 case ACT_INCOMING: | 2035 case ACT_INCOMING: |
2036 if (stderr.contains("authorization failed")) { | 2036 if (stdErr.contains("authorization failed")) { |
2037 reportAuthFailed(stderr); | 2037 reportAuthFailed(stdErr); |
2038 return; | 2038 return; |
2039 } else if (stderr.contains("entry cancelled")) { | 2039 } else if (stdErr.contains("entry cancelled")) { |
2040 // ignore this, user cancelled username or password dialog | 2040 // ignore this, user cancelled username or password dialog |
2041 return; | 2041 return; |
2042 } else { | 2042 } else { |
2043 // Incoming returns non-zero code and no stderr if the | 2043 // Incoming returns non-zero code and no stdErr if the |
2044 // check was successful but there are no changes | 2044 // check was successful but there are no changes |
2045 // pending. This is the only case where we need to remove | 2045 // pending. This is the only case where we need to remove |
2046 // warning messages, because it's the only case where a | 2046 // warning messages, because it's the only case where a |
2047 // non-zero code can be returned even though the command | 2047 // non-zero code can be returned even though the command |
2048 // has for our purposes succeeded | 2048 // has for our purposes succeeded |
2049 QString replaced = stderr; | 2049 QString replaced = stdErr; |
2050 while (1) { | 2050 while (1) { |
2051 QString r1 = replaced; | 2051 QString r1 = replaced; |
2052 r1.replace(QRegExp("warning: [^\\n]*"), ""); | 2052 r1.replace(QRegExp("warning: [^\\n]*"), ""); |
2053 if (r1 == replaced) break; | 2053 if (r1 == replaced) break; |
2054 replaced = r1.trimmed(); | 2054 replaced = r1.trimmed(); |
2058 return; | 2058 return; |
2059 } | 2059 } |
2060 } | 2060 } |
2061 break; // go on to default report | 2061 break; // go on to default report |
2062 case ACT_PULL: | 2062 case ACT_PULL: |
2063 if (stderr.contains("authorization failed")) { | 2063 if (stdErr.contains("authorization failed")) { |
2064 reportAuthFailed(stderr); | 2064 reportAuthFailed(stdErr); |
2065 return; | 2065 return; |
2066 } else if (stderr.contains("entry cancelled")) { | 2066 } else if (stdErr.contains("entry cancelled")) { |
2067 // ignore this, user cancelled username or password dialog | 2067 // ignore this, user cancelled username or password dialog |
2068 return; | 2068 return; |
2069 } else if (stderr.contains("no changes found") || stdout.contains("no changes found")) { | 2069 } else if (stdErr.contains("no changes found") || stdout.contains("no changes found")) { |
2070 // success: hg 2.1 starts returning failure code for empty pull/push | 2070 // success: hg 2.1 starts returning failure code for empty pull/push |
2071 m_commandSequenceInProgress = true; // there may be further commands | 2071 m_commandSequenceInProgress = true; // there may be further commands |
2072 commandCompleted(action, stdout); | 2072 commandCompleted(action, stdout); |
2073 return; | 2073 return; |
2074 } | 2074 } |
2075 break; // go on to default report | 2075 break; // go on to default report |
2076 case ACT_PUSH: | 2076 case ACT_PUSH: |
2077 if (stderr.contains("creates new remote head")) { | 2077 if (stdErr.contains("creates new remote head")) { |
2078 reportNewRemoteHeads(stderr); | 2078 reportNewRemoteHeads(stdErr); |
2079 return; | 2079 return; |
2080 } else if (stderr.contains("authorization failed")) { | 2080 } else if (stdErr.contains("authorization failed")) { |
2081 reportAuthFailed(stderr); | 2081 reportAuthFailed(stdErr); |
2082 return; | 2082 return; |
2083 } else if (stderr.contains("entry cancelled")) { | 2083 } else if (stdErr.contains("entry cancelled")) { |
2084 // ignore this, user cancelled username or password dialog | 2084 // ignore this, user cancelled username or password dialog |
2085 return; | 2085 return; |
2086 } else if (stderr.contains("no changes found") || stdout.contains("no changes found")) { | 2086 } else if (stdErr.contains("no changes found") || stdout.contains("no changes found")) { |
2087 // success: hg 2.1 starts returning failure code for empty pull/push | 2087 // success: hg 2.1 starts returning failure code for empty pull/push |
2088 m_commandSequenceInProgress = true; // there may be further commands | 2088 m_commandSequenceInProgress = true; // there may be further commands |
2089 commandCompleted(action, stdout); | 2089 commandCompleted(action, stdout); |
2090 return; | 2090 return; |
2091 } | 2091 } |
2099 m_commandSequenceInProgress = true; // there may be further commands | 2099 m_commandSequenceInProgress = true; // there may be further commands |
2100 commandCompleted(action, ""); | 2100 commandCompleted(action, ""); |
2101 return; | 2101 return; |
2102 case ACT_FOLDERDIFF: | 2102 case ACT_FOLDERDIFF: |
2103 case ACT_CHGSETDIFF: | 2103 case ACT_CHGSETDIFF: |
2104 // external program, unlikely to be anything useful in stderr | 2104 // external program, unlikely to be anything useful in stdErr |
2105 // and some return with failure codes when something as basic | 2105 // and some return with failure codes when something as basic |
2106 // as the user closing the window via the wm happens | 2106 // as the user closing the window via the wm happens |
2107 return; | 2107 return; |
2108 case ACT_MERGE: | 2108 case ACT_MERGE: |
2109 if (stderr.contains("working directory ancestor")) { | 2109 if (stdErr.contains("working directory ancestor")) { |
2110 // arguably we should prevent this upfront, but that's | 2110 // arguably we should prevent this upfront, but that's |
2111 // trickier! | 2111 // trickier! |
2112 MoreInformationDialog::information | 2112 MoreInformationDialog::information |
2113 (this, tr("Merge"), tr("Merge has no effect"), | 2113 (this, tr("Merge"), tr("Merge has no effect"), |
2114 tr("You asked to merge a revision with one of its ancestors.<p>This has no effect, because the ancestor's changes already exist in both revisions."), | 2114 tr("You asked to merge a revision with one of its ancestors.<p>This has no effect, because the ancestor's changes already exist in both revisions."), |
2115 stderr); | 2115 stdErr); |
2116 return; | 2116 return; |
2117 } | 2117 } |
2118 // else fall through | 2118 // else fall through |
2119 case ACT_RETRY_MERGE: | 2119 case ACT_RETRY_MERGE: |
2120 MoreInformationDialog::information | 2120 MoreInformationDialog::information |
2121 (this, tr("Merge"), tr("Merge failed"), | 2121 (this, tr("Merge"), tr("Merge failed"), |
2122 tr("Some files were not merged successfully.<p>You can Merge again to repeat the interactive merge; use Revert to abandon the merge entirely; or edit the files that are in conflict in an editor and, when you are happy with them, choose Mark Resolved in each file's right-button menu."), | 2122 tr("Some files were not merged successfully.<p>You can Merge again to repeat the interactive merge; use Revert to abandon the merge entirely; or edit the files that are in conflict in an editor and, when you are happy with them, choose Mark Resolved in each file's right-button menu."), |
2123 stderr); | 2123 stdErr); |
2124 m_mergeCommitComment = ""; | 2124 m_mergeCommitComment = ""; |
2125 return; | 2125 return; |
2126 case ACT_STAT: | 2126 case ACT_STAT: |
2127 break; // go on to default report | 2127 break; // go on to default report |
2128 default: | 2128 default: |
2137 | 2137 |
2138 MoreInformationDialog::warning | 2138 MoreInformationDialog::warning |
2139 (this, | 2139 (this, |
2140 tr("Command failed"), | 2140 tr("Command failed"), |
2141 tr("Command failed"), | 2141 tr("Command failed"), |
2142 (stderr == "" ? | 2142 (stdErr == "" ? |
2143 tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.") : | 2143 tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.") : |
2144 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.")), | 2144 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.")), |
2145 stderr); | 2145 stdErr); |
2146 } | 2146 } |
2147 | 2147 |
2148 void MainWindow::commandCompleted(HgAction completedAction, QString output) | 2148 void MainWindow::commandCompleted(HgAction completedAction, QString output) |
2149 { | 2149 { |
2150 // std::cerr << "commandCompleted: " << completedAction.action << std::endl; | 2150 // std::cerr << "commandCompleted: " << completedAction.action << std::endl; |