Git: Make a few objects proper plugin pimpl members

Change-Id: Ib996ed248cd6e10d49fa3ae1086189acfc04de34
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2020-02-07 13:26:29 +01:00
parent eb1226df68
commit 6f2beafaf2
5 changed files with 189 additions and 150 deletions

View File

@@ -158,7 +158,6 @@ public:
void exec() void exec()
{ {
GitClient *client = GitPlugin::client();
QStringList arguments = { QStringList arguments = {
"-c", "color.grep.match=bold red", "-c", "color.grep.match=bold red",
"-c", "color.grep=always", "-c", "color.grep=always",
@@ -188,7 +187,7 @@ public:
return QString(":!" + filter); return QString(":!" + filter);
}); });
arguments << "--" << filterArgs << exclusionArgs; arguments << "--" << filterArgs << exclusionArgs;
QScopedPointer<VcsCommand> command(client->createCommand(m_directory)); QScopedPointer<VcsCommand> command(GitPlugin::client()->createCommand(m_directory));
command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage); command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage);
command->setProgressiveOutput(true); command->setProgressiveOutput(true);
QFutureWatcher<FileSearchResultList> watcher; QFutureWatcher<FileSearchResultList> watcher;
@@ -196,7 +195,7 @@ public:
connect(&watcher, &QFutureWatcher<FileSearchResultList>::canceled, connect(&watcher, &QFutureWatcher<FileSearchResultList>::canceled,
command.data(), &VcsCommand::cancel); command.data(), &VcsCommand::cancel);
connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read); connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read);
SynchronousProcessResponse resp = command->runCommand({client->vcsBinary(), arguments}, 0); SynchronousProcessResponse resp = command->runCommand({GitPlugin::client()->vcsBinary(), arguments}, 0);
switch (resp.result) { switch (resp.result) {
case SynchronousProcessResponse::TerminatedAbnormally: case SynchronousProcessResponse::TerminatedAbnormally:
case SynchronousProcessResponse::StartFailed: case SynchronousProcessResponse::StartFailed:
@@ -235,8 +234,8 @@ static bool isGitDirectory(const QString &path)
return gitVc == VcsManager::findVersionControlForDirectory(path, nullptr); return gitVc == VcsManager::findVersionControlForDirectory(path, nullptr);
} }
GitGrep::GitGrep(QObject *parent) GitGrep::GitGrep(GitClient *client)
: SearchEngine(parent) : m_client(client)
{ {
m_widget = new QWidget; m_widget = new QWidget;
auto layout = new QHBoxLayout(m_widget); auto layout = new QHBoxLayout(m_widget);
@@ -248,7 +247,7 @@ GitGrep::GitGrep(QObject *parent)
const QRegularExpression refExpression("[\\S]*"); const QRegularExpression refExpression("[\\S]*");
m_treeLineEdit->setValidator(new QRegularExpressionValidator(refExpression, this)); m_treeLineEdit->setValidator(new QRegularExpressionValidator(refExpression, this));
layout->addWidget(m_treeLineEdit); layout->addWidget(m_treeLineEdit);
if (GitPlugin::client()->gitVersion() >= 0x021300) { if (client->gitVersion() >= 0x021300) {
m_recurseSubmodules = new QCheckBox(tr("Recurse submodules")); m_recurseSubmodules = new QCheckBox(tr("Recurse submodules"));
layout->addWidget(m_recurseSubmodules); layout->addWidget(m_recurseSubmodules);
} }
@@ -320,7 +319,7 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
QByteArray content; QByteArray content;
const QString topLevel = parameters.additionalParameters.toString(); const QString topLevel = parameters.additionalParameters.toString();
const QString relativePath = QDir(topLevel).relativeFilePath(path); const QString relativePath = QDir(topLevel).relativeFilePath(path);
if (!GitPlugin::client()->synchronousShow(topLevel, params.ref + ":./" + relativePath, if (!m_client->synchronousShow(topLevel, params.ref + ":./" + relativePath,
&content, nullptr)) { &content, nullptr)) {
return nullptr; return nullptr;
} }

View File

@@ -36,12 +36,14 @@ namespace Utils { class FancyLineEdit; }
namespace Git { namespace Git {
namespace Internal { namespace Internal {
class GitClient;
class GitGrep : public TextEditor::SearchEngine class GitGrep : public TextEditor::SearchEngine
{ {
Q_DECLARE_TR_FUNCTIONS(GitGrep) Q_DECLARE_TR_FUNCTIONS(GitGrep)
public: public:
explicit GitGrep(QObject *parent); explicit GitGrep(GitClient *client);
~GitGrep() override; ~GitGrep() override;
QString title() const override; QString title() const override;
QString toolTip() const override; QString toolTip() const override;
@@ -56,6 +58,7 @@ public:
const TextEditor::FileFindParameters &parameters) override; const TextEditor::FileFindParameters &parameters) override;
private: private:
GitClient *m_client;
QWidget *m_widget; QWidget *m_widget;
Utils::FancyLineEdit *m_treeLineEdit; Utils::FancyLineEdit *m_treeLineEdit;
QCheckBox *m_recurseSubmodules = nullptr; QCheckBox *m_recurseSubmodules = nullptr;

View File

@@ -95,6 +95,7 @@ using namespace Core;
using namespace TextEditor; using namespace TextEditor;
using namespace Utils; using namespace Utils;
using namespace VcsBase; using namespace VcsBase;
using namespace std::placeholders;
namespace Git { namespace Git {
namespace Internal { namespace Internal {
@@ -126,30 +127,47 @@ private:
const unsigned minimumRequiredVersion = 0x010900; const unsigned minimumRequiredVersion = 0x010900;
const VcsBaseEditorParameters editorParameters[] = { const VcsBaseSubmitEditorParameters submitParameters {
{ Git::Constants::SUBMIT_MIMETYPE,
Git::Constants::GITSUBMITEDITOR_ID,
Git::Constants::GITSUBMITEDITOR_DISPLAY_NAME,
VcsBaseSubmitEditorParameters::DiffRows
};
const VcsBaseEditorParameters commandLogEditorParameters {
OtherContent, OtherContent,
Git::Constants::GIT_COMMAND_LOG_EDITOR_ID, Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME, Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.commandlog"}, "text/vnd.qtcreator.git.commandlog"
{ LogOutput,
Git::Constants::GIT_LOG_EDITOR_ID,
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.log"},
{ AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_ID,
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.annotation"},
{ OtherContent,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.commit"},
{ OtherContent,
Git::Constants::GIT_REBASE_EDITOR_ID,
Git::Constants::GIT_REBASE_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.rebase"},
}; };
const VcsBaseEditorParameters logEditorParameters {
LogOutput,
Git::Constants::GIT_LOG_EDITOR_ID,
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.log"
};
const VcsBaseEditorParameters blameEditorParameters {
AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_ID,
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.annotation"
};
const VcsBaseEditorParameters commitTextEditorParameters {
OtherContent,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.commit"
};
const VcsBaseEditorParameters rebaseEditorParameters {
OtherContent,
Git::Constants::GIT_REBASE_EDITOR_ID,
Git::Constants::GIT_REBASE_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.rebase"
};
// GitPlugin // GitPlugin
@@ -280,6 +298,10 @@ public:
void applyPatch(const QString &workingDirectory, QString file = QString()); void applyPatch(const QString &workingDirectory, QString file = QString());
void updateVersionWarning(); void updateVersionWarning();
void onApplySettings();;
void describe(const QString &source, const QString &id) { m_gitClient.show(source, id); };
Core::CommandLocator *m_commandLocator = nullptr; Core::CommandLocator *m_commandLocator = nullptr;
QAction *m_menuAction = nullptr; QAction *m_menuAction = nullptr;
@@ -304,13 +326,53 @@ public:
Gerrit::Internal::GerritPlugin *m_gerritPlugin = nullptr; Gerrit::Internal::GerritPlugin *m_gerritPlugin = nullptr;
GitSettings m_settings; GitSettings m_settings;
GitClient *m_gitClient = nullptr; GitClient m_gitClient{&m_settings};
QPointer<StashDialog> m_stashDialog; QPointer<StashDialog> m_stashDialog;
QPointer<BranchViewFactory> m_branchViewFactory; BranchViewFactory m_branchViewFactory;
QPointer<RemoteDialog> m_remoteDialog; QPointer<RemoteDialog> m_remoteDialog;
QString m_submitRepository; QString m_submitRepository;
QString m_commitMessageFileName; QString m_commitMessageFileName;
bool m_submitActionTriggered = false; bool m_submitActionTriggered = false;
GitSettingsPage settingPage{&m_settings, std::bind(&GitPluginPrivate::onApplySettings, this)};
GitGrep gitGrep{&m_gitClient};
VcsEditorFactory commandLogEditorFactory {
&commandLogEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
VcsEditorFactory logEditorFactory {
&logEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
VcsEditorFactory blameEditorFactory {
&blameEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
VcsEditorFactory commitTextEditorFactory {
&commitTextEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
VcsEditorFactory rebaseEditorFactory {
&rebaseEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
VcsSubmitEditorFactory submitEditorFactory {
submitParameters,
[] { return new GitSubmitEditor; },
this
};
}; };
static GitPluginPrivate *dd = nullptr; static GitPluginPrivate *dd = nullptr;
@@ -318,8 +380,6 @@ static GitPluginPrivate *dd = nullptr;
GitPluginPrivate::~GitPluginPrivate() GitPluginPrivate::~GitPluginPrivate()
{ {
cleanCommitMessageFile(); cleanCommitMessageFile();
delete m_gitClient;
delete m_branchViewFactory;
} }
GitPlugin::~GitPlugin() GitPlugin::~GitPlugin()
@@ -328,6 +388,17 @@ GitPlugin::~GitPlugin()
dd = nullptr; dd = nullptr;
} }
void GitPluginPrivate::onApplySettings()
{
configurationChanged();
updateRepositoryBrowserAction();
bool gitFoundOk;
QString errorMessage;
m_settings.gitExecutable(&gitFoundOk, &errorMessage);
if (!gitFoundOk)
Core::AsynchronousMessageBox::warning(tr("Git Settings"), errorMessage);
}
void GitPluginPrivate::cleanCommitMessageFile() void GitPluginPrivate::cleanCommitMessageFile()
{ {
if (!m_commitMessageFileName.isEmpty()) { if (!m_commitMessageFileName.isEmpty()) {
@@ -343,7 +414,7 @@ bool GitPluginPrivate::isCommitEditorOpen() const
GitClient *GitPlugin::client() GitClient *GitPlugin::client()
{ {
return dd->m_gitClient; return &dd->m_gitClient;
} }
IVersionControl *GitPlugin::versionControl() IVersionControl *GitPlugin::versionControl()
@@ -390,13 +461,6 @@ QString GitPlugin::invalidBranchAndRemoteNamePattern()
); );
} }
const VcsBaseSubmitEditorParameters submitParameters = {
Git::Constants::SUBMIT_MIMETYPE,
Git::Constants::GITSUBMITEDITOR_ID,
Git::Constants::GITSUBMITEDITOR_DISPLAY_NAME,
VcsBaseSubmitEditorParameters::DiffRows
};
Command *GitPluginPrivate::createCommand(QAction *action, ActionContainer *ac, Id id, Command *GitPluginPrivate::createCommand(QAction *action, ActionContainer *ac, Id id,
const Context &context, bool addToLocator, const Context &context, bool addToLocator,
const std::function<void()> &callback, const QKeySequence &keys) const std::function<void()> &callback, const QKeySequence &keys)
@@ -477,7 +541,7 @@ QAction *GitPluginPrivate::createRepositoryAction(ActionContainer *ac, const QSt
{ {
auto cb = [this, func]() -> void { auto cb = [this, func]() -> void {
QTC_ASSERT(currentState().hasTopLevel(), return); QTC_ASSERT(currentState().hasTopLevel(), return);
(m_gitClient->*func)(currentState().topLevel()); (m_gitClient.*func)(currentState().topLevel());
}; };
// Set the member func as data and connect to GitClient method // Set the member func as data and connect to GitClient method
return createRepositoryAction(ac, text, id, context, addToLocator, cb, keys); return createRepositoryAction(ac, text, id, context, addToLocator, cb, keys);
@@ -508,8 +572,7 @@ GitPluginPrivate::GitPluginPrivate()
{ {
dd = this; dd = this;
m_gitClient = new GitClient(&m_settings); setTopicCache(new GitTopicCache(&m_gitClient));
setTopicCache(new GitTopicCache(m_gitClient));
m_fileActions.reserve(10); m_fileActions.reserve(10);
m_projectActions.reserve(10); m_projectActions.reserve(10);
@@ -517,31 +580,6 @@ GitPluginPrivate::GitPluginPrivate()
Context context(Constants::GIT_CONTEXT); Context context(Constants::GIT_CONTEXT);
// Create the settings Page
auto onApply = [this] {
configurationChanged();
updateRepositoryBrowserAction();
bool gitFoundOk;
QString errorMessage;
m_settings.gitExecutable(&gitFoundOk, &errorMessage);
if (!gitFoundOk)
Core::AsynchronousMessageBox::warning(tr("Git Settings"), errorMessage);
};
new GitSettingsPage(&m_settings, onApply, this);
new GitGrep(this);
m_branchViewFactory = new BranchViewFactory;
const auto describeFunc = [this](const QString &source, const QString &id) {
m_gitClient->show(source, id);
};
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
const auto widgetCreator = []() { return new GitEditorWidget; };
for (int i = 0; i < editorCount; i++)
new VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this);
new VcsSubmitEditorFactory(submitParameters, [] { return new GitSubmitEditor; }, this, this);
const QString prefix = "git"; const QString prefix = "git";
m_commandLocator = new CommandLocator("Git", prefix, prefix, this); m_commandLocator = new CommandLocator("Git", prefix, prefix, this);
@@ -887,7 +925,7 @@ void GitPluginPrivate::diffCurrentFile()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
m_gitClient->diffFile(state.currentFileTopLevel(), state.relativeCurrentFile()); m_gitClient.diffFile(state.currentFileTopLevel(), state.relativeCurrentFile());
} }
void GitPluginPrivate::diffCurrentProject() void GitPluginPrivate::diffCurrentProject()
@@ -896,16 +934,16 @@ void GitPluginPrivate::diffCurrentProject()
QTC_ASSERT(state.hasProject(), return); QTC_ASSERT(state.hasProject(), return);
const QString relativeProject = state.relativeCurrentProject(); const QString relativeProject = state.relativeCurrentProject();
if (relativeProject.isEmpty()) if (relativeProject.isEmpty())
m_gitClient->diffRepository(state.currentProjectTopLevel()); m_gitClient.diffRepository(state.currentProjectTopLevel());
else else
m_gitClient->diffProject(state.currentProjectTopLevel(), relativeProject); m_gitClient.diffProject(state.currentProjectTopLevel(), relativeProject);
} }
void GitPluginPrivate::logFile() void GitPluginPrivate::logFile()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
m_gitClient->log(state.currentFileTopLevel(), state.relativeCurrentFile(), true); m_gitClient.log(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
} }
void GitPluginPrivate::blameFile() void GitPluginPrivate::blameFile()
@@ -940,7 +978,7 @@ void GitPluginPrivate::blameFile()
} }
} }
} }
VcsBaseEditorWidget *editor = m_gitClient->annotate( VcsBaseEditorWidget *editor = m_gitClient.annotate(
state.currentFileTopLevel(), state.relativeCurrentFile(), QString(), state.currentFileTopLevel(), state.relativeCurrentFile(), QString(),
lineNumber, extraOptions); lineNumber, extraOptions);
if (firstLine > 0) if (firstLine > 0)
@@ -951,14 +989,14 @@ void GitPluginPrivate::logProject()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return); QTC_ASSERT(state.hasProject(), return);
m_gitClient->log(state.currentProjectTopLevel(), state.relativeCurrentProject()); m_gitClient.log(state.currentProjectTopLevel(), state.relativeCurrentProject());
} }
void GitPluginPrivate::logRepository() void GitPluginPrivate::logRepository()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->log(state.topLevel()); m_gitClient.log(state.topLevel());
} }
void GitPluginPrivate::undoFileChanges(bool revertStaging) void GitPluginPrivate::undoFileChanges(bool revertStaging)
@@ -970,7 +1008,7 @@ void GitPluginPrivate::undoFileChanges(bool revertStaging)
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
FileChangeBlocker fcb(state.currentFile()); FileChangeBlocker fcb(state.currentFile());
m_gitClient->revert({state.currentFile()}, revertStaging); m_gitClient.revert({state.currentFile()}, revertStaging);
} }
class ResetItemDelegate : public LogItemDelegate class ResetItemDelegate : public LogItemDelegate
@@ -1012,7 +1050,7 @@ void GitPluginPrivate::resetRepository()
ResetItemDelegate delegate(dialog.widget()); ResetItemDelegate delegate(dialog.widget());
dialog.setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(topLevel))); dialog.setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(topLevel)));
if (dialog.runDialog(topLevel, QString(), LogChangeWidget::IncludeRemotes)) if (dialog.runDialog(topLevel, QString(), LogChangeWidget::IncludeRemotes))
m_gitClient->reset(topLevel, dialog.resetFlag(), dialog.commit()); m_gitClient.reset(topLevel, dialog.resetFlag(), dialog.commit());
} }
void GitPluginPrivate::recoverDeletedFiles() void GitPluginPrivate::recoverDeletedFiles()
@@ -1021,7 +1059,7 @@ void GitPluginPrivate::recoverDeletedFiles()
return; return;
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->recoverDeletedFiles(state.topLevel()); m_gitClient.recoverDeletedFiles(state.topLevel());
} }
void GitPluginPrivate::startRebase() void GitPluginPrivate::startRebase()
@@ -1037,7 +1075,7 @@ void GitPluginPrivate::startRebaseFromCommit(const QString &workingDirectory, QS
{ {
if (!DocumentManager::saveAllModifiedDocuments()) if (!DocumentManager::saveAllModifiedDocuments())
return; return;
if (workingDirectory.isEmpty() || !m_gitClient->canRebase(workingDirectory)) if (workingDirectory.isEmpty() || !m_gitClient.canRebase(workingDirectory))
return; return;
if (commit.isEmpty()) { if (commit.isEmpty()) {
@@ -1049,8 +1087,8 @@ void GitPluginPrivate::startRebaseFromCommit(const QString &workingDirectory, QS
commit = dialog.commit(); commit = dialog.commit();
} }
if (m_gitClient->beginStashScope(workingDirectory, "Rebase-i")) if (m_gitClient.beginStashScope(workingDirectory, "Rebase-i"))
m_gitClient->interactiveRebase(workingDirectory, commit, false); m_gitClient.interactiveRebase(workingDirectory, commit, false);
} }
void GitPluginPrivate::startChangeRelatedAction(const Id &id) void GitPluginPrivate::startChangeRelatedAction(const Id &id)
@@ -1072,10 +1110,10 @@ void GitPluginPrivate::startChangeRelatedAction(const Id &id)
return; return;
if (dialog.command() == Show) { if (dialog.command() == Show) {
m_gitClient->show(workingDirectory, change); m_gitClient.show(workingDirectory, change);
return; return;
} else if (dialog.command() == Archive) { } else if (dialog.command() == Archive) {
m_gitClient->archive(workingDirectory, change); m_gitClient.archive(workingDirectory, change);
return; return;
} }
@@ -1084,13 +1122,13 @@ void GitPluginPrivate::startChangeRelatedAction(const Id &id)
switch (dialog.command()) { switch (dialog.command()) {
case CherryPick: case CherryPick:
m_gitClient->synchronousCherryPick(workingDirectory, change); m_gitClient.synchronousCherryPick(workingDirectory, change);
break; break;
case Revert: case Revert:
m_gitClient->synchronousRevert(workingDirectory, change); m_gitClient.synchronousRevert(workingDirectory, change);
break; break;
case Checkout: case Checkout:
m_gitClient->checkout(workingDirectory, change); m_gitClient.checkout(workingDirectory, change);
break; break;
default: default:
return; return;
@@ -1101,21 +1139,21 @@ void GitPluginPrivate::stageFile()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
m_gitClient->addFile(state.currentFileTopLevel(), state.relativeCurrentFile()); m_gitClient.addFile(state.currentFileTopLevel(), state.relativeCurrentFile());
} }
void GitPluginPrivate::unstageFile() void GitPluginPrivate::unstageFile()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
m_gitClient->synchronousReset(state.currentFileTopLevel(), {state.relativeCurrentFile()}); m_gitClient.synchronousReset(state.currentFileTopLevel(), {state.relativeCurrentFile()});
} }
void GitPluginPrivate::gitkForCurrentFile() void GitPluginPrivate::gitkForCurrentFile()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
m_gitClient->launchGitK(state.currentFileTopLevel(), state.relativeCurrentFile()); m_gitClient.launchGitK(state.currentFileTopLevel(), state.relativeCurrentFile());
} }
void GitPluginPrivate::gitkForCurrentFolder() void GitPluginPrivate::gitkForCurrentFolder()
@@ -1126,7 +1164,7 @@ void GitPluginPrivate::gitkForCurrentFolder()
/* /*
* entire lower part of the code can be easily replaced with one line: * entire lower part of the code can be easily replaced with one line:
* *
* m_gitClient->launchGitK(dir.currentFileDirectory(), "."); * m_gitClient.launchGitK(dir.currentFileDirectory(), ".");
* *
* However, there is a bug in gitk in version 1.7.9.5, and if you run above * However, there is a bug in gitk in version 1.7.9.5, and if you run above
* command, there will be no documents listed in lower right section. * command, there will be no documents listed in lower right section.
@@ -1139,12 +1177,12 @@ void GitPluginPrivate::gitkForCurrentFolder()
*/ */
QDir dir(state.currentFileDirectory()); QDir dir(state.currentFileDirectory());
if (QFileInfo(dir,".git").exists() || dir.cd(".git")) { if (QFileInfo(dir,".git").exists() || dir.cd(".git")) {
m_gitClient->launchGitK(state.currentFileDirectory()); m_gitClient.launchGitK(state.currentFileDirectory());
} else { } else {
QString folderName = dir.absolutePath(); QString folderName = dir.absolutePath();
dir.cdUp(); dir.cdUp();
folderName = folderName.remove(0, dir.absolutePath().length() + 1); folderName = folderName.remove(0, dir.absolutePath().length() + 1);
m_gitClient->launchGitK(dir.absolutePath(), folderName); m_gitClient.launchGitK(dir.absolutePath(), folderName);
} }
} }
@@ -1152,7 +1190,7 @@ void GitPluginPrivate::gitGui()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->launchGitGui(state.topLevel()); m_gitClient.launchGitGui(state.topLevel());
} }
void GitPluginPrivate::startCommit(CommitType commitType) void GitPluginPrivate::startCommit(CommitType commitType)
@@ -1172,7 +1210,7 @@ void GitPluginPrivate::startCommit(CommitType commitType)
QString errorMessage, commitTemplate; QString errorMessage, commitTemplate;
CommitData data(commitType); CommitData data(commitType);
if (!m_gitClient->getCommitData(state.topLevel(), &commitTemplate, data, &errorMessage)) { if (!m_gitClient.getCommitData(state.topLevel(), &commitTemplate, data, &errorMessage)) {
VcsOutputWindow::appendError(errorMessage); VcsOutputWindow::appendError(errorMessage);
return; return;
} }
@@ -1196,7 +1234,7 @@ void GitPluginPrivate::startCommit(CommitType commitType)
void GitPluginPrivate::updateVersionWarning() void GitPluginPrivate::updateVersionWarning()
{ {
unsigned version = m_gitClient->gitVersion(); unsigned version = m_gitClient.gitVersion();
if (!version || version >= minimumRequiredVersion) if (!version || version >= minimumRequiredVersion)
return; return;
IDocument *curDocument = EditorManager::currentDocument(); IDocument *curDocument = EditorManager::currentDocument();
@@ -1285,7 +1323,7 @@ bool GitPluginPrivate::submitEditorAboutToClose()
if (!DocumentManager::saveDocument(editorDocument)) if (!DocumentManager::saveDocument(editorDocument))
return false; return false;
if (!m_gitClient->addAndCommit(m_submitRepository, editor->panelData(), commitType, if (!m_gitClient.addAndCommit(m_submitRepository, editor->panelData(), commitType,
amendSHA1, m_commitMessageFileName, model)) { amendSHA1, m_commitMessageFileName, model)) {
editor->updateFileModel(); editor->updateFileModel();
return false; return false;
@@ -1293,15 +1331,15 @@ bool GitPluginPrivate::submitEditorAboutToClose()
} }
cleanCommitMessageFile(); cleanCommitMessageFile();
if (commitType == FixupCommit) { if (commitType == FixupCommit) {
if (!m_gitClient->beginStashScope(m_submitRepository, "Rebase-fixup", if (!m_gitClient.beginStashScope(m_submitRepository, "Rebase-fixup",
NoPrompt, editor->panelData().pushAction)) { NoPrompt, editor->panelData().pushAction)) {
return false; return false;
} }
m_gitClient->interactiveRebase(m_submitRepository, amendSHA1, true); m_gitClient.interactiveRebase(m_submitRepository, amendSHA1, true);
} else { } else {
m_gitClient->continueCommandIfNeeded(m_submitRepository); m_gitClient.continueCommandIfNeeded(m_submitRepository);
if (editor->panelData().pushAction == NormalPush) { if (editor->panelData().pushAction == NormalPush) {
m_gitClient->push(m_submitRepository); m_gitClient.push(m_submitRepository);
} else if (editor->panelData().pushAction == PushToGerrit) { } else if (editor->panelData().pushAction == PushToGerrit) {
connect(editor, &QObject::destroyed, this, &GitPluginPrivate::delayedPushToGerrit, connect(editor, &QObject::destroyed, this, &GitPluginPrivate::delayedPushToGerrit,
Qt::QueuedConnection); Qt::QueuedConnection);
@@ -1313,7 +1351,7 @@ bool GitPluginPrivate::submitEditorAboutToClose()
void GitPluginPrivate::fetch() void GitPluginPrivate::fetch()
{ {
m_gitClient->fetch(currentState().topLevel(), QString()); m_gitClient.fetch(currentState().topLevel(), QString());
} }
void GitPluginPrivate::pull() void GitPluginPrivate::pull()
@@ -1326,31 +1364,31 @@ void GitPluginPrivate::pull()
bool rebase = m_settings.boolValue(GitSettings::pullRebaseKey); bool rebase = m_settings.boolValue(GitSettings::pullRebaseKey);
if (!rebase) { if (!rebase) {
QString currentBranch = m_gitClient->synchronousCurrentLocalBranch(topLevel); QString currentBranch = m_gitClient.synchronousCurrentLocalBranch(topLevel);
if (!currentBranch.isEmpty()) { if (!currentBranch.isEmpty()) {
currentBranch.prepend("branch."); currentBranch.prepend("branch.");
currentBranch.append(".rebase"); currentBranch.append(".rebase");
rebase = (m_gitClient->readConfigValue(topLevel, currentBranch) == "true"); rebase = (m_gitClient.readConfigValue(topLevel, currentBranch) == "true");
} }
} }
if (!m_gitClient->beginStashScope(topLevel, "Pull", rebase ? Default : AllowUnstashed)) if (!m_gitClient.beginStashScope(topLevel, "Pull", rebase ? Default : AllowUnstashed))
return; return;
m_gitClient->pull(topLevel, rebase); m_gitClient.pull(topLevel, rebase);
} }
void GitPluginPrivate::push() void GitPluginPrivate::push()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->push(state.topLevel()); m_gitClient.push(state.topLevel());
} }
void GitPluginPrivate::startMergeTool() void GitPluginPrivate::startMergeTool()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->merge(state.topLevel()); m_gitClient.merge(state.topLevel());
} }
void GitPluginPrivate::continueOrAbortCommand() void GitPluginPrivate::continueOrAbortCommand()
@@ -1362,21 +1400,21 @@ void GitPluginPrivate::continueOrAbortCommand()
QObject *action = QObject::sender(); QObject *action = QObject::sender();
if (action == m_abortMergeAction) if (action == m_abortMergeAction)
m_gitClient->synchronousMerge(state.topLevel(), "--abort"); m_gitClient.synchronousMerge(state.topLevel(), "--abort");
else if (action == m_abortRebaseAction) else if (action == m_abortRebaseAction)
m_gitClient->rebase(state.topLevel(), "--abort"); m_gitClient.rebase(state.topLevel(), "--abort");
else if (action == m_abortCherryPickAction) else if (action == m_abortCherryPickAction)
m_gitClient->synchronousCherryPick(state.topLevel(), "--abort"); m_gitClient.synchronousCherryPick(state.topLevel(), "--abort");
else if (action == m_abortRevertAction) else if (action == m_abortRevertAction)
m_gitClient->synchronousRevert(state.topLevel(), "--abort"); m_gitClient.synchronousRevert(state.topLevel(), "--abort");
else if (action == m_skipRebaseAction) else if (action == m_skipRebaseAction)
m_gitClient->rebase(state.topLevel(), "--skip"); m_gitClient.rebase(state.topLevel(), "--skip");
else if (action == m_continueRebaseAction) else if (action == m_continueRebaseAction)
m_gitClient->rebase(state.topLevel(), "--continue"); m_gitClient.rebase(state.topLevel(), "--continue");
else if (action == m_continueCherryPickAction) else if (action == m_continueCherryPickAction)
m_gitClient->cherryPick(state.topLevel(), "--continue"); m_gitClient.cherryPick(state.topLevel(), "--continue");
else if (action == m_continueRevertAction) else if (action == m_continueRevertAction)
m_gitClient->revert(state.topLevel(), "--continue"); m_gitClient.revert(state.topLevel(), "--continue");
updateContinueAndAbortCommands(); updateContinueAndAbortCommands();
} }
@@ -1402,7 +1440,7 @@ void GitPluginPrivate::cleanRepository(const QString &directory)
QStringList files; QStringList files;
QStringList ignoredFiles; QStringList ignoredFiles;
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
const bool gotFiles = m_gitClient->synchronousCleanList(directory, QString(), &files, &ignoredFiles, &errorMessage); const bool gotFiles = m_gitClient.synchronousCleanList(directory, QString(), &files, &ignoredFiles, &errorMessage);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if (!gotFiles) { if (!gotFiles) {
@@ -1425,7 +1463,7 @@ void GitPluginPrivate::updateSubmodules()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->updateSubmodulesIfNeeded(state.topLevel(), false); m_gitClient.updateSubmodulesIfNeeded(state.topLevel(), false);
} }
// If the file is modified in an editor, make sure it is saved. // If the file is modified in an editor, make sure it is saved.
@@ -1454,20 +1492,20 @@ void GitPluginPrivate::promptApplyPatch()
void GitPluginPrivate::applyPatch(const QString &workingDirectory, QString file) void GitPluginPrivate::applyPatch(const QString &workingDirectory, QString file)
{ {
// Ensure user has been notified about pending changes // Ensure user has been notified about pending changes
if (!m_gitClient->beginStashScope(workingDirectory, "Apply-Patch", AllowUnstashed)) if (!m_gitClient.beginStashScope(workingDirectory, "Apply-Patch", AllowUnstashed))
return; return;
// Prompt for file // Prompt for file
if (file.isEmpty()) { if (file.isEmpty()) {
const QString filter = tr("Patches (*.patch *.diff)"); const QString filter = tr("Patches (*.patch *.diff)");
file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("Choose Patch"), QString(), filter); file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("Choose Patch"), QString(), filter);
if (file.isEmpty()) { if (file.isEmpty()) {
m_gitClient->endStashScope(workingDirectory); m_gitClient.endStashScope(workingDirectory);
return; return;
} }
} }
// Run! // Run!
QString errorMessage; QString errorMessage;
if (m_gitClient->synchronousApplyPatch(workingDirectory, file, &errorMessage)) { if (m_gitClient.synchronousApplyPatch(workingDirectory, file, &errorMessage)) {
if (errorMessage.isEmpty()) if (errorMessage.isEmpty())
VcsOutputWindow::appendMessage(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory)); VcsOutputWindow::appendMessage(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory));
else else
@@ -1475,7 +1513,7 @@ void GitPluginPrivate::applyPatch(const QString &workingDirectory, QString file)
} else { } else {
VcsOutputWindow::appendError(errorMessage); VcsOutputWindow::appendError(errorMessage);
} }
m_gitClient->endStashScope(workingDirectory); m_gitClient.endStashScope(workingDirectory);
} }
void GitPluginPrivate::stash(bool unstagedOnly) void GitPluginPrivate::stash(bool unstagedOnly)
@@ -1487,7 +1525,7 @@ void GitPluginPrivate::stash(bool unstagedOnly)
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
const QString topLevel = state.topLevel(); const QString topLevel = state.topLevel();
m_gitClient->executeSynchronousStash(topLevel, QString(), unstagedOnly); m_gitClient.executeSynchronousStash(topLevel, QString(), unstagedOnly);
if (m_stashDialog) if (m_stashDialog)
m_stashDialog->refresh(topLevel, true); m_stashDialog->refresh(topLevel, true);
} }
@@ -1502,7 +1540,7 @@ void GitPluginPrivate::stashSnapshot()
// Prompt for description, restore immediately and keep on working. // Prompt for description, restore immediately and keep on working.
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
const QString id = m_gitClient->synchronousStash(state.topLevel(), QString(), const QString id = m_gitClient.synchronousStash(state.topLevel(), QString(),
GitClient::StashImmediateRestore | GitClient::StashPromptDescription); GitClient::StashImmediateRestore | GitClient::StashPromptDescription);
if (!id.isEmpty() && m_stashDialog) if (!id.isEmpty() && m_stashDialog)
m_stashDialog->refresh(state.topLevel(), true); m_stashDialog->refresh(state.topLevel(), true);
@@ -1513,7 +1551,7 @@ void GitPluginPrivate::stashPop()
if (!DocumentManager::saveAllModifiedDocuments()) if (!DocumentManager::saveAllModifiedDocuments())
return; return;
const QString repository = currentState().topLevel(); const QString repository = currentState().topLevel();
m_gitClient->stashPop(repository); m_gitClient.stashPop(repository);
if (m_stashDialog) if (m_stashDialog)
m_stashDialog->refresh(repository, true); m_stashDialog->refresh(repository, true);
} }
@@ -1560,8 +1598,8 @@ void GitPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
const bool repositoryEnabled = state.hasTopLevel(); const bool repositoryEnabled = state.hasTopLevel();
if (m_stashDialog) if (m_stashDialog)
m_stashDialog->refresh(state.topLevel(), false); m_stashDialog->refresh(state.topLevel(), false);
if (m_branchViewFactory && m_branchViewFactory->view()) if (m_branchViewFactory.view())
m_branchViewFactory->view()->refresh(state.topLevel(), false); m_branchViewFactory.view()->refresh(state.topLevel(), false);
if (m_remoteDialog) if (m_remoteDialog)
m_remoteDialog->refresh(state.topLevel(), false); m_remoteDialog->refresh(state.topLevel(), false);
@@ -1585,7 +1623,7 @@ void GitPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
repositoryAction->setEnabled(repositoryEnabled); repositoryAction->setEnabled(repositoryEnabled);
m_submoduleUpdateAction->setVisible(repositoryEnabled m_submoduleUpdateAction->setVisible(repositoryEnabled
&& !m_gitClient->submoduleList(state.topLevel()).isEmpty()); && !m_gitClient.submoduleList(state.topLevel()).isEmpty());
updateContinueAndAbortCommands(); updateContinueAndAbortCommands();
updateRepositoryBrowserAction(); updateRepositoryBrowserAction();
@@ -1597,7 +1635,7 @@ void GitPluginPrivate::updateContinueAndAbortCommands()
{ {
if (currentState().hasTopLevel()) { if (currentState().hasTopLevel()) {
GitClient::CommandInProgress gitCommandInProgress = GitClient::CommandInProgress gitCommandInProgress =
m_gitClient->checkCommandInProgress(currentState().topLevel()); m_gitClient.checkCommandInProgress(currentState().topLevel());
m_mergeToolAction->setVisible(gitCommandInProgress != GitClient::NoCommand); m_mergeToolAction->setVisible(gitCommandInProgress != GitClient::NoCommand);
m_abortMergeAction->setVisible(gitCommandInProgress == GitClient::Merge); m_abortMergeAction->setVisible(gitCommandInProgress == GitClient::Merge);
@@ -1633,14 +1671,14 @@ void GitPluginPrivate::delayedPushToGerrit()
void GitPluginPrivate::updateBranches(const QString &repository) void GitPluginPrivate::updateBranches(const QString &repository)
{ {
if (m_branchViewFactory && m_branchViewFactory->view()) if (m_branchViewFactory.view())
m_branchViewFactory->view()->refreshIfSame(repository); m_branchViewFactory.view()->refreshIfSame(repository);
} }
void GitPluginPrivate::updateCurrentBranch() void GitPluginPrivate::updateCurrentBranch()
{ {
if (m_branchViewFactory && m_branchViewFactory->view()) if (m_branchViewFactory.view())
m_branchViewFactory->view()->refreshCurrentBranch(); m_branchViewFactory.view()->refreshCurrentBranch();
} }
QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &workingDirectory, QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &workingDirectory,
@@ -1686,7 +1724,7 @@ bool GitPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) con
bool GitPluginPrivate::isConfigured() const bool GitPluginPrivate::isConfigured() const
{ {
return !m_gitClient->vcsBinary().isEmpty(); return !m_gitClient.vcsBinary().isEmpty();
} }
bool GitPluginPrivate::supportsOperation(Operation operation) const bool GitPluginPrivate::supportsOperation(Operation operation) const
@@ -1715,31 +1753,31 @@ bool GitPluginPrivate::vcsOpen(const QString & /*fileName*/)
bool GitPluginPrivate::vcsAdd(const QString & fileName) bool GitPluginPrivate::vcsAdd(const QString & fileName)
{ {
const QFileInfo fi(fileName); const QFileInfo fi(fileName);
return m_gitClient->synchronousAdd(fi.absolutePath(), {fi.fileName()}); return m_gitClient.synchronousAdd(fi.absolutePath(), {fi.fileName()});
} }
bool GitPluginPrivate::vcsDelete(const QString & fileName) bool GitPluginPrivate::vcsDelete(const QString & fileName)
{ {
const QFileInfo fi(fileName); const QFileInfo fi(fileName);
return m_gitClient->synchronousDelete(fi.absolutePath(), true, {fi.fileName()}); return m_gitClient.synchronousDelete(fi.absolutePath(), true, {fi.fileName()});
} }
bool GitPluginPrivate::vcsMove(const QString &from, const QString &to) bool GitPluginPrivate::vcsMove(const QString &from, const QString &to)
{ {
const QFileInfo fromInfo(from); const QFileInfo fromInfo(from);
const QFileInfo toInfo(to); const QFileInfo toInfo(to);
return m_gitClient->synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath()); return m_gitClient.synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
} }
bool GitPluginPrivate::vcsCreateRepository(const QString &directory) bool GitPluginPrivate::vcsCreateRepository(const QString &directory)
{ {
return m_gitClient->synchronousInit(directory); return m_gitClient.synchronousInit(directory);
} }
QString GitPluginPrivate::vcsTopic(const QString &directory) QString GitPluginPrivate::vcsTopic(const QString &directory)
{ {
QString topic = Core::IVersionControl::vcsTopic(directory); QString topic = Core::IVersionControl::vcsTopic(directory);
const QString commandInProgress = m_gitClient->commandInProgressDescription(directory); const QString commandInProgress = m_gitClient.commandInProgressDescription(directory);
if (!commandInProgress.isEmpty()) if (!commandInProgress.isEmpty())
topic += " (" + commandInProgress + ')'; topic += " (" + commandInProgress + ')';
return topic; return topic;
@@ -1753,9 +1791,9 @@ Core::ShellCommand *GitPluginPrivate::createInitialCheckoutCommand(const QString
QStringList args = {"clone", "--progress"}; QStringList args = {"clone", "--progress"};
args << extraArgs << url << localName; args << extraArgs << url << localName;
auto command = new VcsBase::VcsCommand(baseDirectory.toString(), m_gitClient->processEnvironment()); auto command = new VcsBase::VcsCommand(baseDirectory.toString(), m_gitClient.processEnvironment());
command->addFlags(VcsBase::VcsCommand::SuppressStdErr); command->addFlags(VcsBase::VcsCommand::SuppressStdErr);
command->addJob({m_gitClient->vcsBinary(), args}, -1); command->addJob({m_gitClient.vcsBinary(), args}, -1);
return command; return command;
} }
@@ -1766,8 +1804,8 @@ GitPluginPrivate::RepoUrl GitPluginPrivate::getRepoUrl(const QString &location)
QStringList GitPluginPrivate::additionalToolsPath() const QStringList GitPluginPrivate::additionalToolsPath() const
{ {
QStringList res = m_gitClient->settings().searchPathList(); QStringList res = m_gitClient.settings().searchPathList();
const QString binaryPath = m_gitClient->gitBinDirectory().toString(); const QString binaryPath = m_gitClient.gitBinDirectory().toString();
if (!binaryPath.isEmpty() && !res.contains(binaryPath)) if (!binaryPath.isEmpty() && !res.contains(binaryPath))
res << binaryPath; res << binaryPath;
return res; return res;
@@ -1775,7 +1813,7 @@ QStringList GitPluginPrivate::additionalToolsPath() const
bool GitPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const bool GitPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const
{ {
const QString topLevelFound = m_gitClient->findRepositoryForDirectory(directory); const QString topLevelFound = m_gitClient.findRepositoryForDirectory(directory);
if (topLevel) if (topLevel)
*topLevel = topLevelFound; *topLevel = topLevelFound;
return !topLevelFound.isEmpty(); return !topLevelFound.isEmpty();
@@ -1783,19 +1821,19 @@ bool GitPluginPrivate::managesDirectory(const QString &directory, QString *topLe
bool GitPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const bool GitPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
{ {
return m_gitClient->managesFile(workingDirectory, fileName); return m_gitClient.managesFile(workingDirectory, fileName);
} }
QStringList GitPluginPrivate::unmanagedFiles(const QString &workingDir, QStringList GitPluginPrivate::unmanagedFiles(const QString &workingDir,
const QStringList &filePaths) const const QStringList &filePaths) const
{ {
return m_gitClient->unmanagedFiles(workingDir, filePaths); return m_gitClient.unmanagedFiles(workingDir, filePaths);
} }
bool GitPluginPrivate::vcsAnnotate(const QString &file, int line) bool GitPluginPrivate::vcsAnnotate(const QString &file, int line)
{ {
const QFileInfo fi(file); const QFileInfo fi(file);
m_gitClient->annotate(fi.absolutePath(), fi.fileName(), QString(), line); m_gitClient.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
return true; return true;
} }
@@ -1935,7 +1973,7 @@ void GitPlugin::testDiffFileResolving_data()
void GitPlugin::testDiffFileResolving() void GitPlugin::testDiffFileResolving()
{ {
VcsBaseEditorWidget::testDiffFileResolving(editorParameters[3].id); VcsBaseEditorWidget::testDiffFileResolving(commitTextEditorParameters.id);
} }
void GitPlugin::testLogResolving() void GitPlugin::testLogResolving()
@@ -1961,7 +1999,7 @@ void GitPlugin::testLogResolving()
" Signed-off-by: Junio C Hamano <gitster@pobox.com>\n" " Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"
); );
VcsBaseEditorWidget::testLogResolving(editorParameters[1].id, data, VcsBaseEditorWidget::testLogResolving(logEditorParameters.id, data,
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn", "50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
"3587b513 - Update draft release notes to 1.8.2"); "3587b513 - Update draft release notes to 1.8.2");
} }

View File

@@ -126,8 +126,7 @@ void GitSettingsPageWidget::updateNoteField()
// -------- SettingsPage // -------- SettingsPage
GitSettingsPage::GitSettingsPage(GitSettings *settings, const std::function<void()> &onChange, QObject *parent) : GitSettingsPage::GitSettingsPage(GitSettings *settings, const std::function<void()> &onChange)
Core::IOptionsPage(parent)
{ {
setId(VcsBase::Constants::VCS_ID_GIT); setId(VcsBase::Constants::VCS_ID_GIT);
setDisplayName(GitSettingsPageWidget::tr("Git")); setDisplayName(GitSettingsPageWidget::tr("Git"));

View File

@@ -35,7 +35,7 @@ class GitSettings;
class GitSettingsPage final : public Core::IOptionsPage class GitSettingsPage final : public Core::IOptionsPage
{ {
public: public:
GitSettingsPage(GitSettings *settings, const std::function<void()> &onChange, QObject *parent); GitSettingsPage(GitSettings *settings, const std::function<void()> &onChange);
}; };
} // namespace Internal } // namespace Internal