diff mainwindow.cpp @ 288:ca6edd303c9d

Add "Summarise changes" options to changeset item right-button menu (already existed for uncommitted item)
author Chris Cannam
date Mon, 21 Feb 2011 11:37:58 +0000
parents a68801b31ceb
children 37f67999b661
line wrap: on
line diff
--- a/mainwindow.cpp	Mon Feb 21 09:13:22 2011 +0000
+++ b/mainwindow.cpp	Mon Feb 21 11:37:58 2011 +0000
@@ -545,7 +545,7 @@
     
     params << "diff" << "--stat";
 
-    m_runner->requestAction(HgAction(ACT_DIFF_SUMMARY, m_workFolderPath, params));
+    m_runner->requestAction(HgAction(ACT_UNCOMMITTED_SUMMARY, m_workFolderPath, params));
 }
 
 void MainWindow::hgFolderDiff()
@@ -601,6 +601,18 @@
 }
 
 
+void MainWindow::hgShowSummaryToParent(QString child, QString parent)
+{
+    QStringList params;
+
+    params << "diff" << "--stat"
+           << "--rev" << Changeset::hashOf(parent)
+           << "--rev" << Changeset::hashOf(child);
+
+    m_runner->requestAction(HgAction(ACT_DIFF_SUMMARY, m_workFolderPath, params));
+}
+
+
 void MainWindow::hgUpdate()
 {
     QStringList params;
@@ -1897,13 +1909,28 @@
         m_shouldHgStat = true;
         break;
 
-    case ACT_DIFF_SUMMARY:
+    case ACT_UNCOMMITTED_SUMMARY:
         QMessageBox::information(this, tr("Change summary"),
                                  format3(tr("Summary of uncommitted changes"),
                                          "",
                                          output));
         break;
 
+    case ACT_DIFF_SUMMARY:
+        if (output == "") {
+            // Can happen, for a merge commit
+            QMessageBox::information(this, tr("Change summary"),
+                                     format3(tr("Summary of changes"),
+                                             tr("No changes"),
+                                             output));
+        } else {
+            QMessageBox::information(this, tr("Change summary"),
+                                     format3(tr("Summary of changes"),
+                                             "",
+                                             output));
+        }            
+        break;
+
     case ACT_FOLDERDIFF:
     case ACT_CHGSETDIFF:
     case ACT_SERVE:
@@ -2079,6 +2106,9 @@
     connect(m_hgTabs, SIGNAL(diffToParent(QString, QString)),
             this, SLOT(hgDiffToParent(QString, QString)));
 
+    connect(m_hgTabs, SIGNAL(showSummaryToParent(QString, QString)),
+            this, SLOT(hgShowSummaryToParent(QString, QString)));
+
     connect(m_hgTabs, SIGNAL(mergeFrom(QString)),
             this, SLOT(hgMergeFrom(QString)));