Skip to content
Snippets Groups Projects
Commit d967b641 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Git: Add reset button to branches dialog


Task-number: QTCREATORBUG-11391

Change-Id: I5146a8b00a88124f96c788cba2bbfa786618ee20
Reviewed-by: default avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent ccd99638
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,7 @@ BranchDialog::BranchDialog(QWidget *parent) :
connect(m_ui->renameButton, SIGNAL(clicked()), this, SLOT(rename()));
connect(m_ui->diffButton, SIGNAL(clicked()), this, SLOT(diff()));
connect(m_ui->logButton, SIGNAL(clicked()), this, SLOT(log()));
connect(m_ui->resetButton, SIGNAL(clicked()), this, SLOT(reset()));
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()));
......@@ -320,6 +321,22 @@ void BranchDialog::log()
GitPlugin::instance()->gitClient()->log(QString(m_repository), QString(), false, QStringList(branchName));
}
void BranchDialog::reset()
{
QString currentName = m_model->fullName(m_model->currentBranch(), true);
QString branchName = m_model->fullName(selectedIndex(), true);
if (currentName.isEmpty() || branchName.isEmpty())
return;
if (QMessageBox::question(this, tr("Git Reset"), tr("Hard reset branch '%1' to '%2'?")
.arg(currentName).arg(branchName),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
GitPlugin::instance()->gitClient()->reset(QString(m_repository), QLatin1String("--hard"),
branchName);
}
}
void BranchDialog::merge()
{
if (!Core::DocumentManager::saveAllModifiedDocuments())
......
......@@ -70,6 +70,7 @@ private slots:
void rename();
void diff();
void log();
void reset();
void merge();
void rebase();
void cherryPick();
......
......@@ -130,6 +130,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="resetButton">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment