Git: Enable choosing non-fast-forward merge

Change-Id: I5972489d06637616953bd0d93a3b65c4d9918377
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
This commit is contained in:
Orgad Shaneh
2013-12-02 23:28:58 +02:00
committed by Orgad Shaneh
parent 0c0c1cd58f
commit 4a5af14b7f
3 changed files with 34 additions and 5 deletions

View File

@@ -38,11 +38,14 @@
#include "stashdialog.h" // Label helpers
#include <utils/qtcassert.h>
#include <utils/execmenu.h>
#include <vcsbase/vcsbaseoutputwindow.h>
#include <QAction>
#include <QItemSelectionModel>
#include <QMessageBox>
#include <QList>
#include <QMenu>
#include <QDebug>
@@ -321,8 +324,18 @@ void BranchDialog::merge()
const QString branch = m_model->fullName(idx, true);
GitClient *client = GitPlugin::instance()->gitClient();
bool allowFastForward = true;
if (client->isFastForwardMerge(m_repository, branch)) {
QMenu popup;
QAction *fastForward = popup.addAction(tr("Fast-Forward"));
popup.addAction(tr("No Fast-Forward"));
QAction *chosen = Utils::execMenuAtWidget(&popup, m_ui->mergeButton);
if (!chosen)
return;
allowFastForward = (chosen == fastForward);
}
if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
client->synchronousMerge(m_repository, branch);
client->synchronousMerge(m_repository, branch, allowFastForward);
}
void BranchDialog::rebase()