forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.7'
Conflicts: src/plugins/qnx/blackberrydeployconfiguration.cpp Change-Id: I16d1c7717f4bc25ba7e8dbdd5be6580fafe3f33d
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "settingspage.h"
|
||||
#include "resetdialog.h"
|
||||
#include "mergetool.h"
|
||||
#include "gitutils.h"
|
||||
|
||||
#include "gerrit/gerritplugin.h"
|
||||
|
||||
@@ -55,6 +56,7 @@
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
@@ -81,6 +83,8 @@
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
|
||||
static const unsigned minimumRequiredVersion = 0x010702;
|
||||
|
||||
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
VcsBase::RegularCommandOutput,
|
||||
@@ -848,6 +852,26 @@ void GitPlugin::startCommit(bool amend)
|
||||
openSubmitEditor(m_commitMessageFileName, data, amend);
|
||||
}
|
||||
|
||||
void GitPlugin::updateVersionWarning()
|
||||
{
|
||||
if (m_gitClient->gitVersion() >= minimumRequiredVersion)
|
||||
return;
|
||||
Core::IEditor *curEditor = Core::EditorManager::currentEditor();
|
||||
if (!curEditor)
|
||||
return;
|
||||
Core::IDocument *curDocument = curEditor->document();
|
||||
if (!curDocument)
|
||||
return;
|
||||
Core::InfoBar *infoBar = curDocument->infoBar();
|
||||
Core::Id gitVersionWarning("GitVersionWarning");
|
||||
if (!infoBar->canInfoBeAdded(gitVersionWarning))
|
||||
return;
|
||||
infoBar->addInfo(Core::InfoBarEntry(gitVersionWarning,
|
||||
tr("Unsupported version of Git found. Git %1 or later required.")
|
||||
.arg(versionString(minimumRequiredVersion)),
|
||||
Core::InfoBarEntry::GlobalSuppressionEnabled));
|
||||
}
|
||||
|
||||
Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd, bool amend)
|
||||
{
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID,
|
||||
@@ -934,22 +958,25 @@ void GitPlugin::pull()
|
||||
{
|
||||
const VcsBase::VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
QString topLevel = state.topLevel();
|
||||
bool rebase = m_gitClient->settings()->boolValue(GitSettings::pullRebaseKey);
|
||||
|
||||
if (!rebase) {
|
||||
bool isDetached;
|
||||
QString branchRebaseConfig = m_gitClient->synchronousRepositoryBranches(state.topLevel(), &isDetached).at(0);
|
||||
QString branchRebaseConfig = m_gitClient->synchronousRepositoryBranches(topLevel, &isDetached).at(0);
|
||||
if (!isDetached) {
|
||||
branchRebaseConfig.prepend(QLatin1String("branch."));
|
||||
branchRebaseConfig.append(QLatin1String(".rebase"));
|
||||
rebase = (m_gitClient->readConfigValue(state.topLevel(), branchRebaseConfig) == QLatin1String("true"));
|
||||
rebase = (m_gitClient->readConfigValue(topLevel, branchRebaseConfig) == QLatin1String("true"));
|
||||
}
|
||||
}
|
||||
|
||||
GitClient::StashGuard stashGuard(state.topLevel(), QLatin1String("Pull"));
|
||||
if (stashGuard.stashingFailed(false) || (rebase && (stashGuard.result() == GitClient::NotStashed)))
|
||||
GitClient::StashGuard stashGuard(topLevel, QLatin1String("Pull"));
|
||||
if (stashGuard.stashingFailed(false))
|
||||
return;
|
||||
if (!m_gitClient->synchronousPull(state.topLevel(), rebase))
|
||||
if (rebase && (stashGuard.result() == GitClient::NotStashed))
|
||||
m_gitClient->synchronousCheckoutFiles(topLevel);
|
||||
if (!m_gitClient->synchronousPull(topLevel, rebase))
|
||||
stashGuard.preventPop();
|
||||
}
|
||||
|
||||
@@ -1157,6 +1184,8 @@ void GitPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
|
||||
m_commandLocator->setEnabled(repositoryEnabled);
|
||||
if (!enableMenuAction(as, m_menuAction))
|
||||
return;
|
||||
if (repositoryEnabled)
|
||||
updateVersionWarning();
|
||||
// Note: This menu is visible if there is no repository. Only
|
||||
// 'Create Repository'/'Show' actions should be available.
|
||||
const QString fileName = currentState().currentFileName();
|
||||
|
Reference in New Issue
Block a user