Mercurial > hg > easyhg
changeset 311:4811eb34e819 new-branches-with-status-outside-tabs
Add Start New Branch and Cancel New Branch to uncommitted item menu; add branch name to Commit dialog
author | Chris Cannam |
---|---|
date | Tue, 01 Mar 2011 14:22:29 +0000 |
parents | 7f50c040e13d |
children | f98c8ece3035 |
files | changesetscene.cpp changesetscene.h easyhg_en.qm easyhg_en.ts grapher.cpp hgtabwidget.cpp hgtabwidget.h historywidget.cpp historywidget.h mainwindow.cpp mainwindow.h uncommitteditem.cpp uncommitteditem.h |
diffstat | 13 files changed, 92 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/changesetscene.cpp Mon Feb 28 14:24:14 2011 +0000 +++ b/changesetscene.cpp Tue Mar 01 14:22:29 2011 +0000 @@ -77,6 +77,13 @@ connect(item, SIGNAL(showWork()), this, SIGNAL(showWork())); + + connect(item, SIGNAL(newBranch()), + this, SIGNAL(newBranch())); + + connect(item, SIGNAL(noBranch()), + this, SIGNAL(noBranch())); + } void
--- a/changesetscene.h Mon Feb 28 14:24:14 2011 +0000 +++ b/changesetscene.h Tue Mar 01 14:22:29 2011 +0000 @@ -44,6 +44,8 @@ void diffWorkingFolder(); void showSummary(); void showWork(); + void newBranch(); + void noBranch(); void updateTo(QString id); void diffToParent(QString id, QString parent);
--- a/easyhg_en.ts Mon Feb 28 14:24:14 2011 +0000 +++ b/easyhg_en.ts Tue Mar 01 14:22:29 2011 +0000 @@ -588,10 +588,10 @@ </message> <message numerus="yes"> <location filename="mainwindow.cpp" line="308"/> - <source>You are about to commit %n file(s).</source> + <source>You are about to commit %n file(s) to %1.</source> <translation type="unfinished"> - <numerusform>You are about to commit %n file.</numerusform> - <numerusform>You are about to commit %n files.</numerusform> + <numerusform>You are about to commit %n file to %1.</numerusform> + <numerusform>You are about to commit %n files to %1.</numerusform> </translation> </message> <message>
--- a/grapher.cpp Mon Feb 28 14:24:14 2011 +0000 +++ b/grapher.cpp Tue Mar 01 14:22:29 2011 +0000 @@ -233,6 +233,7 @@ } } + // Normally the children will lay out themselves, but we can do // a better job in some special cases: @@ -431,18 +432,32 @@ // Add uncommitted item and connecting line as necessary if (!m_uncommittedParents.empty()) { + m_uncommitted = new UncommittedItem(); m_uncommitted->setBranch(uncommittedBranch); m_uncommitted->setZValue(10); m_scene->addUncommittedItem(m_uncommitted); + + bool haveParentOnBranch = false; foreach (QString p, m_uncommittedParents) { ConnectionItem *conn = new ConnectionItem(); conn->setConnectionType(ConnectionItem::Merge); - conn->setParent(m_items[p]); + ChangesetItem *pitem = m_items[p]; + conn->setParent(pitem); conn->setChild(m_uncommitted); conn->setZValue(0); m_scene->addItem(conn); + if (pitem) { + if (pitem->getChangeset()->branch() == uncommittedBranch) { + haveParentOnBranch = true; + } + } } + + // If the uncommitted item has no parents on the same branch, + // tell it it has a new branch (the "show branch" flag is set + // elsewhere for this item) + m_uncommitted->setIsNewBranch(!haveParentOnBranch); } // Add the branch labels
--- a/hgtabwidget.cpp Mon Feb 28 14:24:14 2011 +0000 +++ b/hgtabwidget.cpp Tue Mar 01 14:22:29 2011 +0000 @@ -52,6 +52,12 @@ connect(m_historyWidget, SIGNAL(showSummary()), this, SIGNAL(showSummary())); + connect(m_historyWidget, SIGNAL(newBranch()), + this, SIGNAL(newBranch())); + + connect(m_historyWidget, SIGNAL(noBranch()), + this, SIGNAL(noBranch())); + connect(m_historyWidget, SIGNAL(diffWorkingFolder()), this, SIGNAL(diffWorkingFolder()));
--- a/hgtabwidget.h Mon Feb 28 14:24:14 2011 +0000 +++ b/hgtabwidget.h Tue Mar 01 14:22:29 2011 +0000 @@ -87,6 +87,8 @@ void revert(); void diffWorkingFolder(); void showSummary(); + void newBranch(); + void noBranch(); void updateTo(QString id); void diffToParent(QString id, QString parent);
--- a/historywidget.cpp Mon Feb 28 14:24:14 2011 +0000 +++ b/historywidget.cpp Tue Mar 01 14:22:29 2011 +0000 @@ -268,6 +268,12 @@ connect(scene, SIGNAL(showWork()), this, SIGNAL(showWork())); + + connect(scene, SIGNAL(newBranch()), + this, SIGNAL(newBranch())); + + connect(scene, SIGNAL(noBranch()), + this, SIGNAL(noBranch())); connect(scene, SIGNAL(updateTo(QString)), this, SIGNAL(updateTo(QString)));
--- a/historywidget.h Mon Feb 28 14:24:14 2011 +0000 +++ b/historywidget.h Tue Mar 01 14:22:29 2011 +0000 @@ -51,6 +51,8 @@ void diffWorkingFolder(); void showSummary(); void showWork(); + void newBranch(); + void noBranch(); void updateTo(QString id); void diffToParent(QString id, QString parent);
--- a/mainwindow.cpp Mon Feb 28 14:24:14 2011 +0000 +++ b/mainwindow.cpp Tue Mar 01 14:22:29 2011 +0000 @@ -429,14 +429,21 @@ QString cf(tr("Commit files")); + QString branchText; + if (m_currentBranch == "" || m_currentBranch == "default") { + branchText = tr("the default branch"); + } else { + branchText = tr("branch \"%1\"").arg(m_currentBranch); + } + if (ConfirmCommentDialog::confirmAndGetLongComment (this, cf, tr("<h3>%1</h3><p>%2%3").arg(cf) - .arg(tr("You are about to commit the following files.")) + .arg(tr("You are about to commit the following files to %1.").arg(branchText)) .arg(subsetNote), tr("<h3>%1</h3><p>%2%3").arg(cf) - .arg(tr("You are about to commit %n file(s).", "", reportFiles.size())) + .arg(tr("You are about to commit %n file(s) to %1.", "", reportFiles.size()).arg(branchText)) .arg(subsetNote), reportFiles, comment, @@ -472,7 +479,7 @@ } -void MainWindow::hgNewBranch(QString id) +void MainWindow::hgNewBranch() { QStringList params; QString branch; @@ -492,6 +499,19 @@ } +void MainWindow::hgNoBranch() +{ + if (m_currentParents.empty()) return; + + QString parentBranch = m_currentParents[0]->branch(); + if (parentBranch == "") parentBranch = "default"; + + QStringList params; + params << "branch" << parentBranch; + m_runner->requestAction(HgAction(ACT_NEW_BRANCH, m_workFolderPath, params)); +} + + void MainWindow::hgTag(QString id) { QStringList params; @@ -2173,6 +2193,12 @@ connect(m_hgTabs, SIGNAL(showSummary()), this, SLOT(hgShowSummary())); + + connect(m_hgTabs, SIGNAL(newBranch()), + this, SLOT(hgNewBranch())); + + connect(m_hgTabs, SIGNAL(noBranch()), + this, SLOT(hgNoBranch())); connect(m_hgTabs, SIGNAL(updateTo(QString)), this, SLOT(hgUpdateToRev(QString))); @@ -2190,7 +2216,7 @@ this, SLOT(hgMergeFrom(QString))); connect(m_hgTabs, SIGNAL(newBranch(QString)), - this, SLOT(hgNewBranch(QString))); + this, SLOT(hgNewBranch())); connect(m_hgTabs, SIGNAL(tag(QString)), this, SLOT(hgTag(QString)));
--- a/mainwindow.h Mon Feb 28 14:24:14 2011 +0000 +++ b/mainwindow.h Tue Mar 01 14:22:29 2011 +0000 @@ -90,7 +90,8 @@ void hgAnnotate(); void hgResolveList(); void hgTag(QString); - void hgNewBranch(QString); + void hgNewBranch(); + void hgNoBranch(); void hgServe(); void hgIgnore();
--- a/uncommitteditem.cpp Mon Feb 28 14:24:14 2011 +0000 +++ b/uncommitteditem.cpp Tue Mar 01 14:22:29 2011 +0000 @@ -29,7 +29,8 @@ #include <QWidgetAction> UncommittedItem::UncommittedItem() : - m_showBranch(false), m_column(0), m_row(0), m_wide(false) + m_showBranch(false), m_isNewBranch(false), + m_column(0), m_row(0), m_wide(false) { m_font = QFont(); m_font.setPixelSize(11); @@ -87,6 +88,14 @@ QAction *revert = menu->addAction(tr("Revert...")); connect(revert, SIGNAL(triggered()), this, SIGNAL(revert())); + menu->addSeparator(); + + QAction *branch = menu->addAction(tr("Start new branch...")); + connect(branch, SIGNAL(triggered()), this, SIGNAL(newBranch())); + QAction *nobranch = menu->addAction(tr("Cancel new branch")); + nobranch->setEnabled(m_isNewBranch); + connect(nobranch, SIGNAL(triggered()), this, SIGNAL(noBranch())); + menu->exec(QCursor::pos()); ungrabMouse();
--- a/uncommitteditem.h Mon Feb 28 14:24:14 2011 +0000 +++ b/uncommitteditem.h Tue Mar 01 14:22:29 2011 +0000 @@ -36,6 +36,9 @@ bool showBranch() const { return m_showBranch; } void setShowBranch(bool s) { m_showBranch = s; } + + bool isNewBranch() const { return m_isNewBranch; } + void setIsNewBranch(bool s) { m_isNewBranch = s; } int column() const { return m_column; } int row() const { return m_row; } @@ -51,6 +54,8 @@ void diff(); void showSummary(); void showWork(); + void newBranch(); + void noBranch(); protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent *); @@ -61,6 +66,7 @@ QString m_branch; bool m_showBranch; + bool m_isNewBranch; QFont m_font; int m_column; int m_row;