Mercurial > hg > easyhg
comparison mainwindow.cpp @ 289:37f67999b661
We can provide a better interface for most common cases by essentially showing a formatted log for the summary rather than a diff only
author | Chris Cannam |
---|---|
date | Mon, 21 Feb 2011 12:15:04 +0000 |
parents | ca6edd303c9d |
children | 7b4f42cfc596 |
comparison
equal
deleted
inserted
replaced
288:ca6edd303c9d | 289:37f67999b661 |
---|---|
599 | 599 |
600 m_runner->requestAction(HgAction(ACT_CHGSETDIFF, m_workFolderPath, params)); | 600 m_runner->requestAction(HgAction(ACT_CHGSETDIFF, m_workFolderPath, params)); |
601 } | 601 } |
602 | 602 |
603 | 603 |
604 void MainWindow::hgShowSummaryToParent(QString child, QString parent) | 604 void MainWindow::hgShowSummaryFor(Changeset *cs) |
605 { | 605 { |
606 QStringList params; | 606 QStringList params; |
607 | 607 |
608 params << "diff" << "--stat" | 608 // This will pick a default parent if there is more than one |
609 << "--rev" << Changeset::hashOf(parent) | 609 // (whereas with diff we need to supply one). But it does need a |
610 << "--rev" << Changeset::hashOf(child); | 610 // bit more parsing |
611 | 611 params << "log" << "--stat" << "--rev" << Changeset::hashOf(cs->id()); |
612 m_runner->requestAction(HgAction(ACT_DIFF_SUMMARY, m_workFolderPath, params)); | 612 |
613 m_runner->requestAction(HgAction(ACT_DIFF_SUMMARY, m_workFolderPath, | |
614 params, cs)); | |
613 } | 615 } |
614 | 616 |
615 | 617 |
616 void MainWindow::hgUpdate() | 618 void MainWindow::hgUpdate() |
617 { | 619 { |
1915 "", | 1917 "", |
1916 output)); | 1918 output)); |
1917 break; | 1919 break; |
1918 | 1920 |
1919 case ACT_DIFF_SUMMARY: | 1921 case ACT_DIFF_SUMMARY: |
1920 if (output == "") { | 1922 { |
1921 // Can happen, for a merge commit | 1923 // Output has log info first, diff following after a blank line |
1924 output.replace("\r\n", "\n"); | |
1925 QStringList olist = output.split("\n\n", QString::SkipEmptyParts); | |
1926 if (olist.size() > 1) output = olist[1]; | |
1927 | |
1928 Changeset *cs = (Changeset *)completedAction.extraData; | |
1929 if (cs) { | |
1930 QMessageBox::information | |
1931 (this, tr("Change summary"), | |
1932 format3(tr("Summary of changes"), | |
1933 cs->formatHtml(), | |
1934 output)); | |
1935 } else if (output == "") { | |
1936 // Can happen, for a merge commit (depending on parent) | |
1922 QMessageBox::information(this, tr("Change summary"), | 1937 QMessageBox::information(this, tr("Change summary"), |
1923 format3(tr("Summary of changes"), | 1938 format3(tr("Summary of changes"), |
1924 tr("No changes"), | 1939 tr("No changes"), |
1925 output)); | 1940 output)); |
1926 } else { | 1941 } else { |
1928 format3(tr("Summary of changes"), | 1943 format3(tr("Summary of changes"), |
1929 "", | 1944 "", |
1930 output)); | 1945 output)); |
1931 } | 1946 } |
1932 break; | 1947 break; |
1948 } | |
1933 | 1949 |
1934 case ACT_FOLDERDIFF: | 1950 case ACT_FOLDERDIFF: |
1935 case ACT_CHGSETDIFF: | 1951 case ACT_CHGSETDIFF: |
1936 case ACT_SERVE: | 1952 case ACT_SERVE: |
1937 case ACT_HG_IGNORE: | 1953 case ACT_HG_IGNORE: |
2104 this, SLOT(hgDiffToCurrent(QString))); | 2120 this, SLOT(hgDiffToCurrent(QString))); |
2105 | 2121 |
2106 connect(m_hgTabs, SIGNAL(diffToParent(QString, QString)), | 2122 connect(m_hgTabs, SIGNAL(diffToParent(QString, QString)), |
2107 this, SLOT(hgDiffToParent(QString, QString))); | 2123 this, SLOT(hgDiffToParent(QString, QString))); |
2108 | 2124 |
2109 connect(m_hgTabs, SIGNAL(showSummaryToParent(QString, QString)), | 2125 connect(m_hgTabs, SIGNAL(showSummary(Changeset *)), |
2110 this, SLOT(hgShowSummaryToParent(QString, QString))); | 2126 this, SLOT(hgShowSummaryFor(Changeset *))); |
2111 | 2127 |
2112 connect(m_hgTabs, SIGNAL(mergeFrom(QString)), | 2128 connect(m_hgTabs, SIGNAL(mergeFrom(QString)), |
2113 this, SLOT(hgMergeFrom(QString))); | 2129 this, SLOT(hgMergeFrom(QString))); |
2114 | 2130 |
2115 connect(m_hgTabs, SIGNAL(tag(QString)), | 2131 connect(m_hgTabs, SIGNAL(tag(QString)), |