forked from qt-creator/qt-creator
Git: Add reset button to branches dialog
Task-number: QTCREATORBUG-11391 Change-Id: I5146a8b00a88124f96c788cba2bbfa786618ee20 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -71,6 +71,7 @@ BranchDialog::BranchDialog(QWidget *parent) :
|
|||||||
connect(m_ui->renameButton, SIGNAL(clicked()), this, SLOT(rename()));
|
connect(m_ui->renameButton, SIGNAL(clicked()), this, SLOT(rename()));
|
||||||
connect(m_ui->diffButton, SIGNAL(clicked()), this, SLOT(diff()));
|
connect(m_ui->diffButton, SIGNAL(clicked()), this, SLOT(diff()));
|
||||||
connect(m_ui->logButton, SIGNAL(clicked()), this, SLOT(log()));
|
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->mergeButton, SIGNAL(clicked()), this, SLOT(merge()));
|
||||||
connect(m_ui->rebaseButton, SIGNAL(clicked()), this, SLOT(rebase()));
|
connect(m_ui->rebaseButton, SIGNAL(clicked()), this, SLOT(rebase()));
|
||||||
connect(m_ui->cherryPickButton, SIGNAL(clicked()), this, SLOT(cherryPick()));
|
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));
|
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()
|
void BranchDialog::merge()
|
||||||
{
|
{
|
||||||
if (!Core::DocumentManager::saveAllModifiedDocuments())
|
if (!Core::DocumentManager::saveAllModifiedDocuments())
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ private slots:
|
|||||||
void rename();
|
void rename();
|
||||||
void diff();
|
void diff();
|
||||||
void log();
|
void log();
|
||||||
|
void reset();
|
||||||
void merge();
|
void merge();
|
||||||
void rebase();
|
void rebase();
|
||||||
void cherryPick();
|
void cherryPick();
|
||||||
|
|||||||
@@ -130,6 +130,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user