# HG changeset patch
# User Chris Cannam
# Date 1300383280 0
# Node ID 73fb5ef55744c8f1e02d4946f5dacdffda6568d3
# Parent f34848e8094b726536bf630655fd50d98f766f57# Parent 4cd753e083cc6227813b5df64b3342b1d77b83a4
Merge from branch "feature_91b". Really fixes #91
diff -r f34848e8094b -r 73fb5ef55744 filestates.cpp
--- 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;
}
diff -r f34848e8094b -r 73fb5ef55744 filestates.h
--- 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,
diff -r f34848e8094b -r 73fb5ef55744 filestatuswidget.cpp
--- 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;
diff -r f34848e8094b -r 73fb5ef55744 filestatuswidget.h
--- 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);
diff -r f34848e8094b -r 73fb5ef55744 hgaction.h
--- 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
diff -r f34848e8094b -r 73fb5ef55744 hgtabwidget.cpp
--- 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)));
diff -r f34848e8094b -r 73fb5ef55744 hgtabwidget.h
--- 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);
diff -r f34848e8094b -r 73fb5ef55744 mainwindow.cpp
--- 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 %1
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 %1
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)));
diff -r f34848e8094b -r 73fb5ef55744 mainwindow.h
--- 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);