# HG changeset patch # User Jari Korhonen # Date 1273934063 -10800 # Node ID 45c4ac1323b2bdf3fd67d65fb8c92d87707b1ef5 # Parent efb7b1654af475b85545c3b4ddb201ca07105402 Version 0.4.2: Added hg serve. Can commit one file. diff -r efb7b1654af4 -r 45c4ac1323b2 hgrunner.cpp --- a/hgrunner.cpp Sat May 15 17:32:45 2010 +0300 +++ b/hgrunner.cpp Sat May 15 17:34:23 2010 +0300 @@ -82,7 +82,10 @@ { setProcExitInfo(proc -> exitCode(), proc -> exitStatus()); - presentErrorToUser(); + if (reportErrors) + { + presentErrorToUser(); + } isRunning = false; } diff -r efb7b1654af4 -r 45c4ac1323b2 mainwindow.cpp --- a/mainwindow.cpp Sat May 15 17:32:45 2010 +0300 +++ b/mainwindow.cpp Sat May 15 17:34:23 2010 +0300 @@ -314,7 +314,18 @@ { if (!comment.isEmpty()) { - params << "commit" << "--message" << comment << "--user" << userInfo; + QString currentFile = hgExp -> getCurrentFileListLine(); + + if (isSelectedCommitable(hgExp -> workFolderFileList)) + { + //User wants to commit only one file + params << "commit" << "--message" << comment << "--user" << userInfo << currentFile.mid(2); + } + else + { + //Commit all changes + params << "commit" << "--message" << comment << "--user" << userInfo; + } runner -> startProc(getHgBinaryName(), workFolderPath, params); runningAction = ACT_COMMIT; @@ -518,6 +529,24 @@ } +void MainWindow::hgServe() +{ + if (runningAction == ACT_NONE) + { + QStringList params; + + params << "serve"; + + runner -> startProc(getHgBinaryName(), workFolderPath, params, false); + runningAction = ACT_SERVE; + + QMessageBox::information(this, "Serve", "Server running", QMessageBox::Close); + runner -> killProc(); + } +} + + + void MainWindow::settings() { SettingsDialog *settingsDlg = new SettingsDialog(this); @@ -572,6 +601,26 @@ } +bool MainWindow::isSelectedCommitable(QListWidget *workList) +{ + QList selList = workList -> selectedItems(); + if (selList.count() == 1) + { + QString tmp = selList.at(0)->text().mid(0, 1); + if (tmp == "A") + { + //scheduled to be added, ok to commit + return true; + } + else if (tmp == "M") + { + //locally modified, ok to commit + return true; + } + } + return false; +} + bool MainWindow::isSelectedDeletable(QListWidget *workList) { QList selList = workList -> selectedItems(); @@ -758,6 +807,7 @@ case ACT_FOLDERDIFF: case ACT_CHGSETDIFF: case ACT_REVERT: + case ACT_SERVE: shouldHgStat = true; break; @@ -840,6 +890,7 @@ connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList())); connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark())); + connect(hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe())); } void MainWindow::tabChanged(int currTab) @@ -906,6 +957,7 @@ hgResolveListAct -> setEnabled(localRepoActionsEnabled); hgResolveMarkAct -> setEnabled(localRepoActionsEnabled); hgAnnotateAct -> setEnabled(localRepoActionsEnabled); + hgServeAct -> setEnabled(localRepoActionsEnabled); hgExp -> enableDisableOtherTabs(); @@ -1053,8 +1105,8 @@ hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("Update working folder"), this); hgUpdateAct->setStatusTip(tr("Update working folder from local repository")); - hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit / Save changes"), this); - hgCommitAct->setStatusTip(tr("Save all changes in working folder (and all subfolders) to local repository")); + hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit / Save change(s)"), this); + hgCommitAct->setStatusTip(tr("Save (selected file or all changed files working folder (and all subfolders)) to local repository")); hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("Merge"), this); hgMergeAct->setStatusTip(tr("Merge two local repository changesets to working folder")); @@ -1072,6 +1124,9 @@ hgResolveMarkAct = new QAction(tr("Resolve (mark)"), this); hgResolveMarkAct -> setStatusTip(tr("Resolve (mark): Mark selected file status as resolved")); + hgServeAct = new QAction(tr("Serve (via http)"), this); + hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access")); + //Help actions aboutAct = new QAction(tr("About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); @@ -1097,6 +1152,8 @@ advancedMenu -> addSeparator(); advancedMenu -> addAction(hgResolveListAct); advancedMenu -> addAction(hgResolveMarkAct); + advancedMenu -> addSeparator(); + advancedMenu -> addAction(hgServeAct); helpMenu = menuBar()->addMenu(tr("Help")); helpMenu->addAction(aboutAct); diff -r efb7b1654af4 -r 45c4ac1323b2 mainwindow.h --- a/mainwindow.h Sat May 15 17:32:45 2010 +0300 +++ b/mainwindow.h Sat May 15 17:34:23 2010 +0300 @@ -77,6 +77,7 @@ ACT_REVERT, ACT_MERGE, ACT_RESOLVE_LIST, + ACT_SERVE, ACT_RESOLVE_MARK }; @@ -129,6 +130,7 @@ void hgAnnotate(); void hgResolveList(); void hgResolveMark(); + void hgServe(); private: void hgHeads(); @@ -147,6 +149,7 @@ bool isSelectedModified(QListWidget *workList); bool isSelectedUntracked(QListWidget *workList); bool isSelectedDeletable(QListWidget *workList); + bool isSelectedCommitable(QListWidget *workList); //Actions enabled flags @@ -176,6 +179,7 @@ QAction *hgAnnotateAct; QAction *hgResolveListAct; QAction *hgResolveMarkAct; + QAction *hgServeAct; //Menus QMenu *fileMenu;