Mercurial > hg > easyhg
comparison mainwindow.cpp @ 278:f7cdd5b31aed new-branches
Add "Start new branch" function. I'm not quite satisfied with the location of this one
author | Chris Cannam |
---|---|
date | Wed, 09 Feb 2011 12:03:15 +0000 |
parents | cc95394e2392 |
children | 5b4aa1c24407 |
comparison
equal
deleted
inserted
replaced
277:b6e4643d6c05 | 278:f7cdd5b31aed |
---|---|
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 QString MainWindow::filterTag(QString tag) | 448 QString MainWindow::filterTag(QString tag) |
449 { | 449 { |
450 for(int i = 0; i < tag.size(); i++) | 450 for(int i = 0; i < tag.size(); i++) { |
451 { | 451 if (tag[i].isLower() || tag[i].isUpper() || |
452 if (tag[i].isLower() || tag[i].isUpper() || tag[i].isDigit() || (tag[i] == QChar('.'))) | 452 tag[i].isDigit() || (tag[i] == QChar('.'))) { |
453 { | |
454 //ok | 453 //ok |
455 } | 454 } else { |
456 else | |
457 { | |
458 tag[i] = QChar('_'); | 455 tag[i] = QChar('_'); |
459 } | 456 } |
460 } | 457 } |
461 return tag; | 458 return tag; |
459 } | |
460 | |
461 | |
462 void MainWindow::hgNewBranch(QString id) | |
463 { | |
464 QStringList params; | |
465 QString branch; | |
466 | |
467 if (ConfirmCommentDialog::confirmAndGetShortComment | |
468 (this, | |
469 tr("New Branch"), | |
470 tr("Enter new branch name:"), | |
471 branch, | |
472 tr("Start Branch"))) { | |
473 if (!branch.isEmpty()) {//!!! do something better if it is empty | |
474 | |
475 params << "branch" << filterTag(branch); | |
476 runner->requestAction(HgAction(ACT_NEW_BRANCH, workFolderPath, params)); | |
477 } | |
478 } | |
462 } | 479 } |
463 | 480 |
464 | 481 |
465 void MainWindow::hgTag(QString id) | 482 void MainWindow::hgTag(QString id) |
466 { | 483 { |
1693 enableDisableActions(); | 1710 enableDisableActions(); |
1694 break; | 1711 break; |
1695 case ACT_INCOMING: | 1712 case ACT_INCOMING: |
1696 // returns non-zero code and no output if the check was | 1713 // returns non-zero code and no output if the check was |
1697 // successful but there are no changes pending | 1714 // successful but there are no changes pending |
1715 | |
1716 //!!! -- won't do, there may legitimately be warnings, | |
1717 //!!! -- e.g. certificate not verified | |
1698 if (output.trimmed() == "") { | 1718 if (output.trimmed() == "") { |
1699 showIncoming(""); | 1719 showIncoming(""); |
1700 return; | 1720 return; |
1701 } | 1721 } |
1702 break; | 1722 break; |
1895 case ACT_TAG: | 1915 case ACT_TAG: |
1896 needNewLog = true; | 1916 needNewLog = true; |
1897 shouldHgStat = true; | 1917 shouldHgStat = true; |
1898 break; | 1918 break; |
1899 | 1919 |
1920 case ACT_NEW_BRANCH: | |
1921 shouldHgStat = true; | |
1922 hgTabs->showWorkTab(); | |
1923 break; | |
1924 | |
1900 case ACT_DIFF_SUMMARY: | 1925 case ACT_DIFF_SUMMARY: |
1901 QMessageBox::information(this, tr("Change summary"), | 1926 QMessageBox::information(this, tr("Change summary"), |
1902 format3(tr("Summary of uncommitted changes"), | 1927 format3(tr("Summary of uncommitted changes"), |
1903 "", | 1928 "", |
1904 output)); | 1929 output)); |
2079 connect(hgTabs, SIGNAL(diffToParent(QString, QString)), | 2104 connect(hgTabs, SIGNAL(diffToParent(QString, QString)), |
2080 this, SLOT(hgDiffToParent(QString, QString))); | 2105 this, SLOT(hgDiffToParent(QString, QString))); |
2081 | 2106 |
2082 connect(hgTabs, SIGNAL(mergeFrom(QString)), | 2107 connect(hgTabs, SIGNAL(mergeFrom(QString)), |
2083 this, SLOT(hgMergeFrom(QString))); | 2108 this, SLOT(hgMergeFrom(QString))); |
2109 | |
2110 connect(hgTabs, SIGNAL(newBranch(QString)), | |
2111 this, SLOT(hgNewBranch(QString))); | |
2084 | 2112 |
2085 connect(hgTabs, SIGNAL(tag(QString)), | 2113 connect(hgTabs, SIGNAL(tag(QString)), |
2086 this, SLOT(hgTag(QString))); | 2114 this, SLOT(hgTag(QString))); |
2087 } | 2115 } |
2088 | 2116 |