Mercurial > hg > easyhg
comparison mainwindow.cpp @ 174:4dc802a4d5ae
* Add more helpful reports when a push fails because it would create new heads
author | Chris Cannam |
---|---|
date | Thu, 16 Dec 2010 12:40:04 +0000 |
parents | a6d336837ebe |
children | 6def8bf3be44 |
comparison
equal
deleted
inserted
replaced
173:a6d336837ebe | 174:4dc802a4d5ae |
---|---|
1242 runner->hide(); | 1242 runner->hide(); |
1243 | 1243 |
1244 //!!! and something about updating | 1244 //!!! and something about updating |
1245 | 1245 |
1246 QMessageBox::information(this, "Pull complete", report); | 1246 QMessageBox::information(this, "Pull complete", report); |
1247 } | |
1248 | |
1249 void MainWindow::reportNewRemoteHeads(QString output) | |
1250 { | |
1251 bool headsAreLocal = false; | |
1252 | |
1253 if (currentParents.size() == 1) { | |
1254 int currentBranchHeads = 0; | |
1255 bool parentIsHead = false; | |
1256 Changeset *parent = currentParents[0]; | |
1257 foreach (Changeset *head, currentHeads) { | |
1258 if (head->isOnBranch(currentBranch)) { | |
1259 ++currentBranchHeads; | |
1260 } | |
1261 if (parent->id() == head->id()) { | |
1262 parentIsHead = true; | |
1263 } | |
1264 } | |
1265 if (currentBranchHeads == 2 && parentIsHead) { | |
1266 headsAreLocal = true; | |
1267 } | |
1268 } | |
1269 | |
1270 if (headsAreLocal) { | |
1271 QMessageBox::warning | |
1272 (this, tr("Push failed"), | |
1273 format3(tr("Push failed"), | |
1274 tr("Your local repository could not be pushed to the remote repository.<br><br>You may need to merge the changes locally first.<br><br>The output of the push command was:"), | |
1275 output)); | |
1276 } else { | |
1277 QMessageBox::warning | |
1278 (this, tr("Push failed"), | |
1279 format3(tr("Push failed"), | |
1280 tr("Your local repository could not be pushed to the remote repository.<br><br>The remote repository may have been changed by someone else since you last pushed. Try pulling and merging their changes into your local repository first.<br><br>The output of the push command was:"), | |
1281 output)); | |
1282 } | |
1247 } | 1283 } |
1248 | 1284 |
1249 void MainWindow::commandFailed(HgAction action, QString output) | 1285 void MainWindow::commandFailed(HgAction action, QString output) |
1250 { | 1286 { |
1251 DEBUG << "MainWindow::commandFailed" << endl; | 1287 DEBUG << "MainWindow::commandFailed" << endl; |
1272 case ACT_CHGSETDIFF: | 1308 case ACT_CHGSETDIFF: |
1273 // external program, unlikely to be anything useful in stderr | 1309 // external program, unlikely to be anything useful in stderr |
1274 // and some return with failure codes when something as basic | 1310 // and some return with failure codes when something as basic |
1275 // as the user closing the window via the wm happens | 1311 // as the user closing the window via the wm happens |
1276 return; | 1312 return; |
1277 | 1313 case ACT_PUSH: |
1314 if (output.contains("creates new remote heads")) { | |
1315 reportNewRemoteHeads(output); | |
1316 return; | |
1317 } | |
1278 default: | 1318 default: |
1279 break; | 1319 break; |
1280 } | 1320 } |
1281 | 1321 |
1282 QString command = action.executable; | 1322 QString command = action.executable; |