forked from qt-creator/qt-creator
Git: Fix crash on diff
Task-number: QTCREATORBUG-10138 Change-Id: I7c7f054e6253c677b52a3ea24d7ace562f1ad4af Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
f69b994896
commit
9df379e0dc
@@ -1013,15 +1013,14 @@ DiffEditor::DiffEditor *GitClient::createDiffEditor(const char *registerDynamicP
|
|||||||
* (using the file's codec). Makes use of a dynamic property to find an
|
* (using the file's codec). Makes use of a dynamic property to find an
|
||||||
* existing instance and to reuse it (in case, say, 'git diff foo' is
|
* existing instance and to reuse it (in case, say, 'git diff foo' is
|
||||||
* already open). */
|
* already open). */
|
||||||
VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
|
VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
|
||||||
|
const Core::Id &id,
|
||||||
QString title,
|
QString title,
|
||||||
// Source file or directory
|
const QString &source, // Source file or directory
|
||||||
const QString &source,
|
|
||||||
CodecType codecType,
|
CodecType codecType,
|
||||||
// Dynamic property and value to identify that editor
|
const char *registerDynamicProperty, // Dynamic property and value to identify that editor
|
||||||
const char *registerDynamicProperty,
|
|
||||||
const QString &dynamicPropertyValue,
|
const QString &dynamicPropertyValue,
|
||||||
QWidget *configWidget) const
|
VcsBase::VcsBaseEditorParameterWidget *configWidget) const
|
||||||
{
|
{
|
||||||
VcsBase::VcsBaseEditorWidget *rc = 0;
|
VcsBase::VcsBaseEditorWidget *rc = 0;
|
||||||
QTC_CHECK(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue));
|
QTC_CHECK(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue));
|
||||||
@@ -1219,14 +1218,10 @@ void GitClient::diff(const QString &workingDirectory,
|
|||||||
}
|
}
|
||||||
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
||||||
|
|
||||||
GitFileDiffArgumentsWidget *argWidget = qobject_cast<GitFileDiffArgumentsWidget *>(
|
|
||||||
vcsEditor->configurationWidget());
|
|
||||||
QStringList userDiffArgs = argWidget->arguments();
|
|
||||||
|
|
||||||
QStringList cmdArgs;
|
QStringList cmdArgs;
|
||||||
cmdArgs << QLatin1String("diff")
|
cmdArgs << QLatin1String("diff")
|
||||||
<< QLatin1String(noColorOption)
|
<< QLatin1String(noColorOption)
|
||||||
<< userDiffArgs;
|
<< vcsEditor->configurationWidget()->arguments();
|
||||||
|
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
cmdArgs << QLatin1String("--") << fileName;
|
cmdArgs << QLatin1String("--") << fileName;
|
||||||
@@ -1287,14 +1282,10 @@ void GitClient::diffBranch(const QString &workingDirectory,
|
|||||||
}
|
}
|
||||||
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
||||||
|
|
||||||
GitBranchDiffArgumentsWidget *argWidget = qobject_cast<GitBranchDiffArgumentsWidget *>(
|
|
||||||
vcsEditor->configurationWidget());
|
|
||||||
QStringList userDiffArgs = argWidget->arguments();
|
|
||||||
|
|
||||||
QStringList cmdArgs;
|
QStringList cmdArgs;
|
||||||
cmdArgs << QLatin1String("diff")
|
cmdArgs << QLatin1String("diff")
|
||||||
<< QLatin1String(noColorOption)
|
<< QLatin1String(noColorOption)
|
||||||
<< userDiffArgs
|
<< vcsEditor->configurationWidget()->arguments()
|
||||||
<< branchName;
|
<< branchName;
|
||||||
|
|
||||||
executeGit(workingDirectory, cmdArgs, vcsEditor);
|
executeGit(workingDirectory, cmdArgs, vcsEditor);
|
||||||
@@ -1450,15 +1441,11 @@ void GitClient::show(const QString &source, const QString &id,
|
|||||||
newEditor = vcsEditor->editor();
|
newEditor = vcsEditor->editor();
|
||||||
}
|
}
|
||||||
|
|
||||||
GitShowArgumentsWidget *argWidget = qobject_cast<GitShowArgumentsWidget *>(
|
|
||||||
vcsEditor->configurationWidget());
|
|
||||||
QStringList userArgs = argWidget->arguments();
|
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("show")
|
arguments << QLatin1String("show")
|
||||||
<< QLatin1String(noColorOption)
|
<< QLatin1String(noColorOption)
|
||||||
<< QLatin1String(decorateOption)
|
<< QLatin1String(decorateOption)
|
||||||
<< userArgs
|
<< vcsEditor->configurationWidget()->arguments()
|
||||||
<< id;
|
<< id;
|
||||||
|
|
||||||
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
||||||
@@ -1520,12 +1507,9 @@ void GitClient::blame(const QString &workingDirectory,
|
|||||||
argWidget->setEditor(editor);
|
argWidget->setEditor(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
GitBlameArgumentsWidget *argWidget = qobject_cast<GitBlameArgumentsWidget *>(editor->configurationWidget());
|
|
||||||
QStringList userBlameArgs = argWidget->arguments();
|
|
||||||
|
|
||||||
QStringList arguments(QLatin1String("blame"));
|
QStringList arguments(QLatin1String("blame"));
|
||||||
arguments << QLatin1String("--root");
|
arguments << QLatin1String("--root");
|
||||||
arguments.append(userBlameArgs);
|
arguments.append(editor->configurationWidget()->arguments());
|
||||||
arguments << QLatin1String("--") << fileName;
|
arguments << QLatin1String("--") << fileName;
|
||||||
if (!revision.isEmpty())
|
if (!revision.isEmpty())
|
||||||
arguments << revision;
|
arguments << revision;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace VcsBase {
|
|||||||
class Command;
|
class Command;
|
||||||
class SubmitFileModel;
|
class SubmitFileModel;
|
||||||
class VcsBaseEditorWidget;
|
class VcsBaseEditorWidget;
|
||||||
|
class VcsBaseEditorParameterWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
@@ -363,7 +364,7 @@ private:
|
|||||||
CodecType codecType,
|
CodecType codecType,
|
||||||
const char *registerDynamicProperty,
|
const char *registerDynamicProperty,
|
||||||
const QString &dynamicPropertyValue,
|
const QString &dynamicPropertyValue,
|
||||||
QWidget *configWidget) const;
|
VcsBase::VcsBaseEditorParameterWidget *configWidget) const;
|
||||||
DiffEditor::DiffEditor *createDiffEditor(const char *registerDynamicProperty,
|
DiffEditor::DiffEditor *createDiffEditor(const char *registerDynamicProperty,
|
||||||
const QString &dynamicPropertyValue,
|
const QString &dynamicPropertyValue,
|
||||||
const QString &titlePattern,
|
const QString &titlePattern,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "diffhighlighter.h"
|
#include "diffhighlighter.h"
|
||||||
#include "baseannotationhighlighter.h"
|
#include "baseannotationhighlighter.h"
|
||||||
#include "vcsbaseplugin.h"
|
#include "vcsbaseplugin.h"
|
||||||
|
#include "vcsbaseeditorparameterwidget.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
@@ -566,7 +567,7 @@ public:
|
|||||||
QString m_copyRevisionTextFormat;
|
QString m_copyRevisionTextFormat;
|
||||||
bool m_fileLogAnnotateEnabled;
|
bool m_fileLogAnnotateEnabled;
|
||||||
TextEditor::BaseTextEditor *m_editor;
|
TextEditor::BaseTextEditor *m_editor;
|
||||||
QWidget *m_configurationWidget;
|
VcsBaseEditorParameterWidget *m_configurationWidget;
|
||||||
bool m_mouseDragging;
|
bool m_mouseDragging;
|
||||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||||
|
|
||||||
@@ -1324,7 +1325,7 @@ QString VcsBaseEditorWidget::getTitleId(const QString &workingDirectory,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VcsBaseEditorWidget::setConfigurationWidget(QWidget *w)
|
bool VcsBaseEditorWidget::setConfigurationWidget(VcsBaseEditorParameterWidget *w)
|
||||||
{
|
{
|
||||||
if (!d->m_editor || d->m_configurationWidget)
|
if (!d->m_editor || d->m_configurationWidget)
|
||||||
return false;
|
return false;
|
||||||
@@ -1335,7 +1336,7 @@ bool VcsBaseEditorWidget::setConfigurationWidget(QWidget *w)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *VcsBaseEditorWidget::configurationWidget() const
|
VcsBaseEditorParameterWidget *VcsBaseEditorWidget::configurationWidget() const
|
||||||
{
|
{
|
||||||
return d->m_configurationWidget;
|
return d->m_configurationWidget;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class VcsBaseEditorWidgetPrivate;
|
|||||||
|
|
||||||
class DiffHighlighter;
|
class DiffHighlighter;
|
||||||
class BaseAnnotationHighlighter;
|
class BaseAnnotationHighlighter;
|
||||||
|
class VcsBaseEditorParameterWidget;
|
||||||
|
|
||||||
// Documentation inside
|
// Documentation inside
|
||||||
enum EditorContentType
|
enum EditorContentType
|
||||||
@@ -183,8 +184,8 @@ public:
|
|||||||
const QStringList &fileNames,
|
const QStringList &fileNames,
|
||||||
const QString &revision = QString());
|
const QString &revision = QString());
|
||||||
|
|
||||||
bool setConfigurationWidget(QWidget *w);
|
bool setConfigurationWidget(VcsBaseEditorParameterWidget *w);
|
||||||
QWidget *configurationWidget() const;
|
VcsBaseEditorParameterWidget *configurationWidget() const;
|
||||||
|
|
||||||
/* Tagging editors: Sometimes, an editor should be re-used, for example, when showing
|
/* Tagging editors: Sometimes, an editor should be re-used, for example, when showing
|
||||||
* a diff of the same file with different diff-options. In order to be able to find
|
* a diff of the same file with different diff-options. In order to be able to find
|
||||||
|
|||||||
Reference in New Issue
Block a user