comparison mainwindow.cpp @ 33:ff8d64625aa3

Added retry_merge. Fixed bug in "after merge" commit.
author Jari Korhonen <jtkorhonen@gmail.com>
date Sat, 19 Jun 2010 00:23:09 +0300
parents 4f307720272f
children 43e3b271d293
comparison
equal deleted inserted replaced
32:4f307720272f 33:ff8d64625aa3
34 workFolderPath = ""; 34 workFolderPath = "";
35 35
36 readSettings(); 36 readSettings();
37 37
38 tabPage = 0; 38 tabPage = 0;
39 justMerged = false;
39 hgExp = new HgExpWidget((QWidget *) this, remoteRepoPath, workFolderPath, initialFileTypesBits); 40 hgExp = new HgExpWidget((QWidget *) this, remoteRepoPath, workFolderPath, initialFileTypesBits);
40 setCentralWidget(hgExp); 41 setCentralWidget(hgExp);
41 42
42 setUnifiedTitleAndToolBarOnMac(true); 43 setUnifiedTitleAndToolBarOnMac(true);
43 connectActions(); 44 connectActions();
289 { 290 {
290 if (!comment.isEmpty()) 291 if (!comment.isEmpty())
291 { 292 {
292 QString currentFile = hgExp -> getCurrentFileListLine(); 293 QString currentFile = hgExp -> getCurrentFileListLine();
293 294
294 if (areAllSelectedCommitable(hgExp -> workFolderFileList)) 295 if ((justMerged == false) && (areAllSelectedCommitable(hgExp -> workFolderFileList)))
295 { 296 {
296 //User wants to commit selected file(s) 297 //User wants to commit selected file(s) (and this is not merge commit, which would fail if we selected files)
297 params << "commit" << "--message" << comment << "--user" << userInfo; 298 params << "commit" << "--message" << comment << "--user" << userInfo;
298 299
299 QList <QListWidgetItem *> selList = hgExp -> workFolderFileList -> selectedItems(); 300 QList <QListWidgetItem *> selList = hgExp -> workFolderFileList -> selectedItems();
300 for (int i = 0; i < selList.size(); ++i) 301 for (int i = 0; i < selList.size(); ++i)
301 { 302 {
425 runner -> startProc(getHgBinaryName(), workFolderPath, params); 426 runner -> startProc(getHgBinaryName(), workFolderPath, params);
426 runningAction = ACT_REVERT; 427 runningAction = ACT_REVERT;
427 } 428 }
428 } 429 }
429 430
431 void MainWindow::hgRetryMerge()
432 {
433 if (runningAction == ACT_NONE)
434 {
435 QStringList params;
436
437 params << "resolve" << "--all";
438 runner -> startProc(getHgBinaryName(), workFolderPath, params);
439 runningAction = ACT_RETRY_MERGE;
440 }
441 }
442
443
430 void MainWindow::hgMerge() 444 void MainWindow::hgMerge()
431 { 445 {
432 if (runningAction == ACT_NONE) 446 if (runningAction == ACT_NONE)
433 { 447 {
434 QStringList params; 448 QStringList params;
884 break; 898 break;
885 899
886 case ACT_MERGE: 900 case ACT_MERGE:
887 QMessageBox::information(this, "merge", runner -> getStdOut()); 901 QMessageBox::information(this, "merge", runner -> getStdOut());
888 shouldHgStat = true; 902 shouldHgStat = true;
903 justMerged = true;
904 break;
905
906 case ACT_RETRY_MERGE:
907 QMessageBox::information(this, "retry merge", runner -> getStdOut());
908 shouldHgStat = true;
909 justMerged = true;
889 break; 910 break;
890 911
891 default: 912 default:
892 break; 913 break;
893 } 914 }
940 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); 961 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));
941 connect(hgChgSetDiffAct, SIGNAL(triggered()), this, SLOT(hgChgSetDiff())); 962 connect(hgChgSetDiffAct, SIGNAL(triggered()), this, SLOT(hgChgSetDiff()));
942 connect(hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate())); 963 connect(hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate()));
943 connect(hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert())); 964 connect(hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert()));
944 connect(hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge())); 965 connect(hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge()));
966 connect(hgRetryMergeAct, SIGNAL(triggered()), this, SLOT(hgRetryMerge()));
945 967
946 connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings())); 968 connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings()));
947 969
948 connect(hgInitAct, SIGNAL(triggered()), this, SLOT(hgInit())); 970 connect(hgInitAct, SIGNAL(triggered()), this, SLOT(hgInit()));
949 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote())); 971 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote()));
1020 hgAddAct -> setEnabled(localRepoActionsEnabled); 1042 hgAddAct -> setEnabled(localRepoActionsEnabled);
1021 hgRemoveAct -> setEnabled(localRepoActionsEnabled); 1043 hgRemoveAct -> setEnabled(localRepoActionsEnabled);
1022 hgUpdateAct -> setEnabled(localRepoActionsEnabled); 1044 hgUpdateAct -> setEnabled(localRepoActionsEnabled);
1023 hgCommitAct -> setEnabled(localRepoActionsEnabled); 1045 hgCommitAct -> setEnabled(localRepoActionsEnabled);
1024 hgMergeAct -> setEnabled(localRepoActionsEnabled); 1046 hgMergeAct -> setEnabled(localRepoActionsEnabled);
1047 hgRetryMergeAct -> setEnabled(localRepoActionsEnabled);
1025 hgResolveListAct -> setEnabled(localRepoActionsEnabled); 1048 hgResolveListAct -> setEnabled(localRepoActionsEnabled);
1026 hgResolveMarkAct -> setEnabled(localRepoActionsEnabled); 1049 hgResolveMarkAct -> setEnabled(localRepoActionsEnabled);
1027 hgAnnotateAct -> setEnabled(localRepoActionsEnabled); 1050 hgAnnotateAct -> setEnabled(localRepoActionsEnabled);
1028 hgServeAct -> setEnabled(localRepoActionsEnabled); 1051 hgServeAct -> setEnabled(localRepoActionsEnabled);
1029 1052
1086 hgResolveListAct -> setEnabled(true); 1109 hgResolveListAct -> setEnabled(true);
1087 1110
1088 if (hgExp -> localRepoHeadsList->count() < 2) 1111 if (hgExp -> localRepoHeadsList->count() < 2)
1089 { 1112 {
1090 hgMergeAct -> setEnabled(false); 1113 hgMergeAct -> setEnabled(false);
1114 hgRetryMergeAct -> setEnabled(false);
1091 } 1115 }
1092 1116
1093 QString currentFile = hgExp -> getCurrentFileListLine(); 1117 QString currentFile = hgExp -> getCurrentFileListLine();
1094 if (!currentFile.isEmpty()) 1118 if (!currentFile.isEmpty())
1095 { 1119 {
1197 hgResolveListAct = new QAction(tr("Resolve (list)"), this); 1221 hgResolveListAct = new QAction(tr("Resolve (list)"), this);
1198 hgResolveListAct -> setStatusTip(tr("Resolve (list): Show list of files needing merge")); 1222 hgResolveListAct -> setStatusTip(tr("Resolve (list): Show list of files needing merge"));
1199 1223
1200 hgResolveMarkAct = new QAction(tr("Resolve (mark)"), this); 1224 hgResolveMarkAct = new QAction(tr("Resolve (mark)"), this);
1201 hgResolveMarkAct -> setStatusTip(tr("Resolve (mark): Mark selected file status as resolved")); 1225 hgResolveMarkAct -> setStatusTip(tr("Resolve (mark): Mark selected file status as resolved"));
1226
1227 hgRetryMergeAct = new QAction(tr("Retry merge"), this);
1228 hgRetryMergeAct -> setStatusTip(tr("Retry merge after failed merge attempt."));
1202 1229
1203 hgServeAct = new QAction(tr("Serve (via http)"), this); 1230 hgServeAct = new QAction(tr("Serve (via http)"), this);
1204 hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access")); 1231 hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access"));
1205 1232
1206 //Help actions 1233 //Help actions
1224 advancedMenu = menuBar()->addMenu(tr("Advanced")); 1251 advancedMenu = menuBar()->addMenu(tr("Advanced"));
1225 advancedMenu -> addAction(hgUpdateToRevAct); 1252 advancedMenu -> addAction(hgUpdateToRevAct);
1226 advancedMenu -> addSeparator(); 1253 advancedMenu -> addSeparator();
1227 advancedMenu -> addAction(hgAnnotateAct); 1254 advancedMenu -> addAction(hgAnnotateAct);
1228 advancedMenu -> addSeparator(); 1255 advancedMenu -> addSeparator();
1256 advancedMenu -> addAction(hgRetryMergeAct);
1229 advancedMenu -> addAction(hgResolveListAct); 1257 advancedMenu -> addAction(hgResolveListAct);
1230 advancedMenu -> addAction(hgResolveMarkAct); 1258 advancedMenu -> addAction(hgResolveMarkAct);
1231 advancedMenu -> addSeparator(); 1259 advancedMenu -> addSeparator();
1232 advancedMenu -> addAction(hgServeAct); 1260 advancedMenu -> addAction(hgServeAct);
1233 1261