diff --git a/git/fileviewgitplugin.h b/git/fileviewgitplugin.h
--- a/git/fileviewgitplugin.h
+++ b/git/fileviewgitplugin.h
@@ -56,6 +56,7 @@
void createTag();
void push();
void pull();
+ void merge();
void slotOperationCompleted(int exitCode, QProcess::ExitStatus exitStatus);
void slotOperationError();
@@ -112,6 +113,7 @@
QAction* m_tagAction;
QAction* m_pushAction;
QAction* m_pullAction;
+ QAction* m_mergeAction;
QString m_currentDir;
QProcess m_process;
diff --git a/git/fileviewgitplugin.cpp b/git/fileviewgitplugin.cpp
--- a/git/fileviewgitplugin.cpp
+++ b/git/fileviewgitplugin.cpp
@@ -105,6 +105,10 @@
m_pullAction->setText(xi18nd("@action:inmenu", "Git Pull..."));
connect(m_pullAction, SIGNAL(triggered()),
this, SLOT(pull()));
+ m_mergeAction = new QAction(this);
+ m_mergeAction->setIcon(QIcon::fromTheme("merge"));
+ m_mergeAction->setText(xi18nd("@action:inmenu", "Git Merge..."));
+ connect(m_mergeAction, &QAction::triggered, this, &FileViewGitPlugin::merge);
connect(&m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(slotOperationCompleted(int, QProcess::ExitStatus)));
@@ -340,6 +345,7 @@
bool canCommit = false;
bool showChanges = false;
+ bool shouldMerge = false;
QHash::const_iterator it = m_versionInfoHash.constBegin();
while (it != m_versionInfoHash.constEnd()) {
const ItemVersion state = it.value();
@@ -352,6 +358,7 @@
if (state == ConflictingVersion) {
canCommit = false;
showChanges = true;
+ shouldMerge = true;
break;
}
++it;
@@ -360,8 +367,13 @@
m_showLocalChangesAction->setEnabled(!m_pendingOperation && showChanges);
actions.append(m_showLocalChangesAction);
- m_commitAction->setEnabled(!m_pendingOperation && canCommit);
- actions.append(m_commitAction);
+ if (!shouldMerge) {
+ m_commitAction->setEnabled(!m_pendingOperation && canCommit);
+ actions.append(m_commitAction);
+ } else {
+ m_mergeAction->setEnabled(!m_pendingOperation);
+ actions.append(m_mergeAction);
+ }
m_tagAction->setEnabled(!m_pendingOperation);
actions.append(m_tagAction);
@@ -407,6 +419,13 @@
KRun::runCommand(QLatin1String("git difftool --dir-diff ."), nullptr, m_contextDir);
}
+void FileViewGitPlugin::merge()
+{
+ Q_ASSERT(!m_contextDir.isEmpty());
+
+ KRun::runCommand(QStringLiteral("git mergetool"), nullptr, m_contextDir);
+}
+
void FileViewGitPlugin::checkout()
{
CheckoutDialog dialog;