Mercurial > hg > easyhg
changeset 362:73fb5ef55744
Merge from branch "feature_91b". Really fixes #91
author | Chris Cannam |
---|---|
date | Thu, 17 Mar 2011 17:34:40 +0000 |
parents | f34848e8094b (current diff) 4cd753e083cc (diff) |
children | f89e50d748ed 9bafea5ac56f |
files | mainwindow.cpp mainwindow.h |
diffstat | 9 files changed, 88 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/filestates.cpp Thu Mar 17 16:36:02 2011 +0000 +++ b/filestates.cpp Thu Mar 17 17:34:40 2011 +0000 @@ -144,11 +144,11 @@ switch (s) { case Modified: - a << Annotate << Diff << Commit << Revert << Remove; + a << Annotate << Diff << Commit << Revert << Rename << Copy << Remove; break; case Added: - a << Commit << Revert << Remove; + a << Commit << Revert << Rename << Copy << Remove; break; case Removed: @@ -168,7 +168,7 @@ break; case Clean: - a << Annotate << Remove; + a << Annotate << Rename << Copy << Remove; break; case Ignored: @@ -189,9 +189,10 @@ switch (a) { case Annotate: case Diff: return 0; case Commit: case Revert: return 1; - case Add: case Remove: return 2; - case RedoMerge: case MarkResolved: return 3; - case Ignore: case UnIgnore: return 4; + case Rename: case Copy: return 2; + case Add: case Remove: return 3; + case RedoMerge: case MarkResolved: return 4; + case Ignore: case UnIgnore: return 5; } return 0; }
--- a/filestates.h Thu Mar 17 16:36:02 2011 +0000 +++ b/filestates.h Thu Mar 17 17:34:40 2011 +0000 @@ -62,6 +62,9 @@ Commit, Revert, + Rename, + Copy, + Add, Remove,
--- a/filestatuswidget.cpp Thu Mar 17 16:36:02 2011 +0000 +++ b/filestatuswidget.cpp Thu Mar 17 17:34:40 2011 +0000 @@ -61,6 +61,8 @@ m_actionLabels[FileStates::Diff] = tr("Diff to parent"); m_actionLabels[FileStates::Commit] = tr("Commit..."); m_actionLabels[FileStates::Revert] = tr("Revert to last committed state"); + m_actionLabels[FileStates::Rename] = tr("Rename..."); + m_actionLabels[FileStates::Copy] = tr("Copy..."); m_actionLabels[FileStates::Add] = tr("Add to version control"); m_actionLabels[FileStates::Remove] = tr("Remove from version control"); m_actionLabels[FileStates::RedoMerge] = tr("Redo merge"); @@ -239,6 +241,8 @@ case FileStates::Diff: emit diffFiles(files); break; case FileStates::Commit: emit commitFiles(files); break; case FileStates::Revert: emit revertFiles(files); break; + case FileStates::Rename: emit renameFiles(files); break; + case FileStates::Copy: emit copyFiles(files); break; case FileStates::Add: emit addFiles(files); break; case FileStates::Remove: emit removeFiles(files); break; case FileStates::RedoMerge: emit redoFileMerges(files); break;
--- a/filestatuswidget.h Thu Mar 17 16:36:02 2011 +0000 +++ b/filestatuswidget.h Thu Mar 17 17:34:40 2011 +0000 @@ -62,6 +62,8 @@ void diffFiles(QStringList); void commitFiles(QStringList); void revertFiles(QStringList); + void renameFiles(QStringList); + void copyFiles(QStringList); void addFiles(QStringList); void removeFiles(QStringList); void redoFileMerges(QStringList);
--- a/hgaction.h Thu Mar 17 16:36:02 2011 +0000 +++ b/hgaction.h Thu Mar 17 17:34:40 2011 +0000 @@ -56,6 +56,8 @@ ACT_TAG, ACT_NEW_BRANCH, ACT_HG_IGNORE, + ACT_COPY_FILE, + ACT_RENAME_FILE }; struct HgAction
--- a/hgtabwidget.cpp Thu Mar 17 16:36:02 2011 +0000 +++ b/hgtabwidget.cpp Thu Mar 17 17:34:40 2011 +0000 @@ -52,6 +52,12 @@ connect(m_fileStatusWidget, SIGNAL(revertFiles(QStringList)), this, SIGNAL(revertFiles(QStringList))); + connect(m_fileStatusWidget, SIGNAL(renameFiles(QStringList)), + this, SIGNAL(renameFiles(QStringList))); + + connect(m_fileStatusWidget, SIGNAL(copyFiles(QStringList)), + this, SIGNAL(copyFiles(QStringList))); + connect(m_fileStatusWidget, SIGNAL(addFiles(QStringList)), this, SIGNAL(addFiles(QStringList)));
--- a/hgtabwidget.h Thu Mar 17 16:36:02 2011 +0000 +++ b/hgtabwidget.h Thu Mar 17 17:34:40 2011 +0000 @@ -92,6 +92,8 @@ void diffFiles(QStringList); void commitFiles(QStringList); void revertFiles(QStringList); + void renameFiles(QStringList); + void copyFiles(QStringList); void addFiles(QStringList); void removeFiles(QStringList); void redoFileMerges(QStringList);
--- a/mainwindow.cpp Thu Mar 17 16:36:02 2011 +0000 +++ b/mainwindow.cpp Thu Mar 17 17:34:40 2011 +0000 @@ -783,6 +783,60 @@ } +void MainWindow::hgRenameFiles(QStringList files) +{ + QString renameTo; + + QString file; + if (files.empty()) return; + file = files[0]; + + if (ConfirmCommentDialog::confirmAndGetShortComment + (this, + tr("Rename"), + tr("Rename <code>%1</code> to:").arg(xmlEncode(file)), + renameTo, + tr("Rename"))) { + + if (renameTo != "" && renameTo != file) { + + QStringList params; + + params << "rename" << "--" << file << renameTo; + + m_runner->requestAction(HgAction(ACT_RENAME_FILE, m_workFolderPath, params)); + } + } +} + + +void MainWindow::hgCopyFiles(QStringList files) +{ + QString copyTo; + + QString file; + if (files.empty()) return; + file = files[0]; + + if (ConfirmCommentDialog::confirmAndGetShortComment + (this, + tr("Copy"), + tr("Copy <code>%1</code> to:").arg(xmlEncode(file)), + copyTo, + tr("Copy"))) { + + if (copyTo != "" && copyTo != file) { + + QStringList params; + + params << "copy" << "--" << file << copyTo; + + m_runner->requestAction(HgAction(ACT_COPY_FILE, m_workFolderPath, params)); + } + } +} + + void MainWindow::hgMarkFilesResolved(QStringList files) { QStringList params; @@ -2313,6 +2367,12 @@ connect(m_hgTabs, SIGNAL(revertFiles(QStringList)), this, SLOT(hgRevertFiles(QStringList))); + connect(m_hgTabs, SIGNAL(renameFiles(QStringList)), + this, SLOT(hgRenameFiles(QStringList))); + + connect(m_hgTabs, SIGNAL(copyFiles(QStringList)), + this, SLOT(hgCopyFiles(QStringList))); + connect(m_hgTabs, SIGNAL(addFiles(QStringList)), this, SLOT(hgAddFiles(QStringList)));
--- a/mainwindow.h Thu Mar 17 16:36:02 2011 +0000 +++ b/mainwindow.h Thu Mar 17 17:34:40 2011 +0000 @@ -98,6 +98,8 @@ void hgDiffFiles(QStringList); void hgCommitFiles(QStringList); void hgRevertFiles(QStringList); + void hgRenameFiles(QStringList); + void hgCopyFiles(QStringList); void hgAddFiles(QStringList); void hgRemoveFiles(QStringList); void hgRedoFileMerges(QStringList);