# HG changeset patch # User Jari Korhonen # Date 1273840181 -10800 # Node ID 81a32fffee8f38d527bd0b0344d1f2b6894a92a9 # Parent 7189e9994a60237aaebb00d38492d6718531b661 0.3.9: Remove is now more powerful (can delete files of type ACM!). diff -r 7189e9994a60 -r 81a32fffee8f common.h --- a/common.h Fri May 14 14:50:07 2010 +0300 +++ b/common.h Fri May 14 15:29:41 2010 +0300 @@ -6,7 +6,7 @@ #include #define APPNAME "HgExplorer" -#define APPVERSION "0.3.8" +#define APPVERSION "0.3.9" #define MY_ICON_SIZE 32 #define REPOMENU_TITLE "Repository actions" #define WORKFOLDERMENU_TITLE "Workfolder actions" diff -r 7189e9994a60 -r 81a32fffee8f mainwindow.cpp --- a/mainwindow.cpp Fri May 14 14:50:07 2010 +0300 +++ b/mainwindow.cpp Fri May 14 15:29:41 2010 +0300 @@ -181,10 +181,14 @@ if (!currentFile.isEmpty()) { - params << "remove" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") + if (QMessageBox::Ok == QMessageBox::warning(this, "Remove file", "Really remove file " + currentFile.mid(2) + "?", + QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel)) + { + params << "remove" << "--after" << "--force" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") - runner -> startProc(getHgBinaryName(), workFolderPath, params); - runningAction = ACT_REMOVE; + runner -> startProc(getHgBinaryName(), workFolderPath, params); + runningAction = ACT_REMOVE; + } } } } @@ -568,13 +572,30 @@ } -bool MainWindow::isSelectedLocallyDeleted(QListWidget *workList) +bool MainWindow::isSelectedDeletable(QListWidget *workList) { QList selList = workList -> selectedItems(); if (selList.count() == 1) { - if (selList.at(0)->text().mid(0, 1) == "!") + QString tmp = selList.at(0)->text().mid(0, 1); + if (tmp == "A") { + //scheduled to be added, ok to remove (won't go to repo) + return true; + } + else if (tmp == "C") + { + //Tracked but unchanged, ok to remove + return true; + } + else if (tmp == "M") + { + //locally modified, ok to remove from repo + return true; + } + else if (tmp == "!") + { + //locally deleted, ok to remove from repo return true; } } @@ -922,7 +943,7 @@ hgAddAct -> setEnabled(false); } - if (!isSelectedLocallyDeleted(hgExp -> workFolderFileList)) + if (!isSelectedDeletable(hgExp -> workFolderFileList)) { hgRemoveAct -> setEnabled(false); } diff -r 7189e9994a60 -r 81a32fffee8f mainwindow.h --- a/mainwindow.h Fri May 14 14:50:07 2010 +0300 +++ b/mainwindow.h Fri May 14 15:29:41 2010 +0300 @@ -146,7 +146,7 @@ void countAMRNModifications(QListWidget *workList, int& a, int& m, int& r, int& n); bool isSelectedModified(QListWidget *workList); bool isSelectedUntracked(QListWidget *workList); - bool isSelectedLocallyDeleted(QListWidget *workList); + bool isSelectedDeletable(QListWidget *workList); //Actions enabled flags