Git - Add Cherry Pick in branches dialog

Change-Id: Ic01846e3f8622cfa7b6c6ada8b626af6fa8cb3e9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Petar Perisin
2013-07-11 23:38:33 +02:00
parent 8671bd182c
commit 2ac65aaa7c
3 changed files with 22 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ BranchDialog::BranchDialog(QWidget *parent) :
connect(m_ui->logButton, SIGNAL(clicked()), this, SLOT(log()));
connect(m_ui->mergeButton, SIGNAL(clicked()), this, SLOT(merge()));
connect(m_ui->rebaseButton, SIGNAL(clicked()), this, SLOT(rebase()));
connect(m_ui->cherryPickButton, SIGNAL(clicked()), this, SLOT(cherryPick()));
connect(m_ui->trackButton, SIGNAL(clicked()), this, SLOT(setRemoteTracking()));
m_ui->branchView->setModel(m_model);
@@ -123,6 +124,7 @@ void BranchDialog::enableButtons()
m_ui->checkoutButton->setEnabled(hasActions && !currentSelected);
m_ui->rebaseButton->setEnabled(hasActions && !currentSelected);
m_ui->mergeButton->setEnabled(hasActions && !currentSelected);
m_ui->cherryPickButton->setEnabled(hasActions && !currentSelected);
m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag);
}
@@ -338,6 +340,15 @@ void BranchDialog::rebase()
client->rebase(m_repository, baseBranch);
}
void BranchDialog::cherryPick()
{
QModelIndex idx = selectedIndex();
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
const QString branch = m_model->fullName(idx, true);
GitPlugin::instance()->gitClient()->synchronousCherryPick(m_repository, branch);
}
void BranchDialog::setRemoteTracking()
{
m_model->setRemoteTracking(selectedIndex());