diff options
author | Tobias Hunger <tobias.hunger@digia.com> | 2014-02-24 14:52:25 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@digia.com> | 2014-02-25 15:44:10 +0100 |
commit | d967b6413f1c332a3def524934b7cd55a2527dc8 (patch) | |
tree | 857d44018fdd685edb617308207a199b31c5a578 | |
parent | ccd99638ee328f92f4cc985e41c6d541b5cd1071 (diff) | |
download | qt-creator-d967b6413f1c332a3def524934b7cd55a2527dc8.tar.gz |
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>
-rw-r--r-- | src/plugins/git/branchdialog.cpp | 17 | ||||
-rw-r--r-- | src/plugins/git/branchdialog.h | 1 | ||||
-rw-r--r-- | src/plugins/git/branchdialog.ui | 7 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp index 7a86cd3ec1..a18c9a0d39 100644 --- a/src/plugins/git/branchdialog.cpp +++ b/src/plugins/git/branchdialog.cpp @@ -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()) diff --git a/src/plugins/git/branchdialog.h b/src/plugins/git/branchdialog.h index 841f16150f..c9e7dbcffd 100644 --- a/src/plugins/git/branchdialog.h +++ b/src/plugins/git/branchdialog.h @@ -70,6 +70,7 @@ private slots: void rename(); void diff(); void log(); + void reset(); void merge(); void rebase(); void cherryPick(); diff --git a/src/plugins/git/branchdialog.ui b/src/plugins/git/branchdialog.ui index 92c50a6878..8f7be998ad 100644 --- a/src/plugins/git/branchdialog.ui +++ b/src/plugins/git/branchdialog.ui @@ -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> |