Git: Branches dialog - ensure all documents are saved

Change-Id: Ia48157b10fb2f9eb3a8b9b8e7e541a736dd75b4f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Petar Perisin
2014-01-24 06:31:31 +01:00
parent 86e3d5af5f
commit e163356f9f

View File

@@ -40,6 +40,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/execmenu.h> #include <utils/execmenu.h>
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <coreplugin/documentmanager.h>
#include <QAction> #include <QAction>
#include <QItemSelectionModel> #include <QItemSelectionModel>
@@ -177,6 +178,8 @@ void BranchDialog::add()
void BranchDialog::checkout() void BranchDialog::checkout()
{ {
if (!Core::DocumentManager::saveAllModifiedDocuments())
return;
QModelIndex idx = selectedIndex(); QModelIndex idx = selectedIndex();
const QString currentBranch = m_model->fullName(m_model->currentBranch()); const QString currentBranch = m_model->fullName(m_model->currentBranch());
@@ -319,6 +322,8 @@ void BranchDialog::log()
void BranchDialog::merge() void BranchDialog::merge()
{ {
if (!Core::DocumentManager::saveAllModifiedDocuments())
return;
QModelIndex idx = selectedIndex(); QModelIndex idx = selectedIndex();
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled! QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
@@ -340,6 +345,8 @@ void BranchDialog::merge()
void BranchDialog::rebase() void BranchDialog::rebase()
{ {
if (!Core::DocumentManager::saveAllModifiedDocuments())
return;
QModelIndex idx = selectedIndex(); QModelIndex idx = selectedIndex();
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled! QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
@@ -351,6 +358,8 @@ void BranchDialog::rebase()
void BranchDialog::cherryPick() void BranchDialog::cherryPick()
{ {
if (!Core::DocumentManager::saveAllModifiedDocuments())
return;
QModelIndex idx = selectedIndex(); QModelIndex idx = selectedIndex();
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled! QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!