Mercurial > hg > easyhg
changeset 6:81a32fffee8f
0.3.9: Remove is now more powerful (can delete files of type ACM!).
author | Jari Korhonen <jtkorhonen@gmail.com> |
---|---|
date | Fri, 14 May 2010 15:29:41 +0300 (2010-05-14) |
parents | 7189e9994a60 |
children | 3eacb7831c5b |
files | common.h mainwindow.cpp mainwindow.h testfile.txt |
diffstat | 3 files changed, 29 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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 <QtCore> #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"
--- 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<QListWidgetItem *> 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); }
--- 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