Mercurial > hg > easyhg
comparison src/mainwindow.cpp @ 514:306a62fe851e
Add "Close branch" menu option. Is currently available in some cases where it should not be, and using it exposes the fact that the chain of marked-closed changesets is not yet right in grapher.
author | Chris Cannam |
---|---|
date | Tue, 18 Oct 2011 16:50:05 +0100 |
parents | 459aa20d3eee |
children | 5c846f3c9244 |
comparison
equal
deleted
inserted
replaced
513:ddc7238fc3b0 | 514:306a62fe851e |
---|---|
324 } | 324 } |
325 | 325 |
326 void MainWindow::hgQueryHeadsActive() | 326 void MainWindow::hgQueryHeadsActive() |
327 { | 327 { |
328 QStringList params; | 328 QStringList params; |
329 params << "heads" << "--active"; | 329 params << "heads"; |
330 m_runner->requestAction(HgAction(ACT_QUERY_HEADS_ACTIVE, m_workFolderPath, params)); | 330 m_runner->requestAction(HgAction(ACT_QUERY_HEADS_ACTIVE, m_workFolderPath, params)); |
331 } | 331 } |
332 | 332 |
333 void MainWindow::hgQueryHeads() | 333 void MainWindow::hgQueryHeads() |
334 { | 334 { |
539 if (parentBranch == "") parentBranch = "default"; | 539 if (parentBranch == "") parentBranch = "default"; |
540 | 540 |
541 QStringList params; | 541 QStringList params; |
542 params << "branch" << parentBranch; | 542 params << "branch" << parentBranch; |
543 m_runner->requestAction(HgAction(ACT_NEW_BRANCH, m_workFolderPath, params)); | 543 m_runner->requestAction(HgAction(ACT_NEW_BRANCH, m_workFolderPath, params)); |
544 } | |
545 | |
546 void MainWindow::hgCloseBranch() | |
547 { | |
548 QStringList params; | |
549 | |
550 //!!! how to ensure this doesn't happen when uncommitted changes present? | |
551 | |
552 QString cf(tr("Close branch")); | |
553 QString comment; | |
554 | |
555 QString defaultWarning; | |
556 | |
557 QString branchText; | |
558 if (m_currentBranch == "" || m_currentBranch == "default") { | |
559 branchText = tr("the default branch"); | |
560 defaultWarning = tr("<p><b>Warning:</b> you are asking to close the default branch. This is not usually a good idea!</p>"); | |
561 } else { | |
562 branchText = tr("branch \"%1\"").arg(m_currentBranch); | |
563 } | |
564 | |
565 if (ConfirmCommentDialog::confirmAndGetLongComment | |
566 (this, | |
567 cf, | |
568 tr("<h3>%1</h3><p>%2%3").arg(cf) | |
569 .arg(tr("You are about to close %1.<p>This branch will be marked as closed, will be hidden from the history view, and will no longer accept commits.<p>Please enter your comment for the commit log:").arg(branchText)) | |
570 .arg(defaultWarning), | |
571 comment, | |
572 tr("C&lose branch"))) { | |
573 | |
574 params << "commit" << "--message" << comment | |
575 << "--user" << getUserInfo() << "--close-branch"; | |
576 | |
577 m_runner->requestAction(HgAction(ACT_CLOSE_BRANCH, m_workFolderPath, params)); | |
578 } | |
544 } | 579 } |
545 | 580 |
546 void MainWindow::hgTag(QString id) | 581 void MainWindow::hgTag(QString id) |
547 { | 582 { |
548 QStringList params; | 583 QStringList params; |
2363 m_hgTabs->clearSelections(); | 2398 m_hgTabs->clearSelections(); |
2364 m_justMerged = false; | 2399 m_justMerged = false; |
2365 m_shouldHgStat = true; | 2400 m_shouldHgStat = true; |
2366 break; | 2401 break; |
2367 | 2402 |
2403 case ACT_CLOSE_BRANCH: | |
2404 m_hgTabs->clearSelections(); | |
2405 m_justMerged = false; | |
2406 m_shouldHgStat = true; | |
2407 break; | |
2408 | |
2368 case ACT_REVERT: | 2409 case ACT_REVERT: |
2369 hgMarkFilesResolved(m_lastRevertedFiles); | 2410 hgMarkFilesResolved(m_lastRevertedFiles); |
2370 m_justMerged = false; | 2411 m_justMerged = false; |
2371 break; | 2412 break; |
2372 | 2413 |
2618 connect(m_hgTabs, SIGNAL(mergeFrom(QString)), | 2659 connect(m_hgTabs, SIGNAL(mergeFrom(QString)), |
2619 this, SLOT(hgMergeFrom(QString))); | 2660 this, SLOT(hgMergeFrom(QString))); |
2620 | 2661 |
2621 connect(m_hgTabs, SIGNAL(newBranch(QString)), | 2662 connect(m_hgTabs, SIGNAL(newBranch(QString)), |
2622 this, SLOT(hgNewBranch())); | 2663 this, SLOT(hgNewBranch())); |
2664 | |
2665 connect(m_hgTabs, SIGNAL(closeBranch(QString)), | |
2666 this, SLOT(hgCloseBranch())); | |
2623 | 2667 |
2624 connect(m_hgTabs, SIGNAL(tag(QString)), | 2668 connect(m_hgTabs, SIGNAL(tag(QString)), |
2625 this, SLOT(hgTag(QString))); | 2669 this, SLOT(hgTag(QString))); |
2626 | 2670 |
2627 connect(m_hgTabs, SIGNAL(annotateFiles(QStringList)), | 2671 connect(m_hgTabs, SIGNAL(annotateFiles(QStringList)), |