forked from qt-creator/qt-creator
Vcs: Pimpl plugins
Essentially rename all *Plugin into *PluginPrivate, and pull out the actual IPlugin related pieces into new *Plugin classes. Shift the construction of the PluginPrivate to initialize(), following the general pattern. I tried to keep the patch as mechanical as possible, giving room to some obvious but less mechanical cleanup needs, that are intentionally left out of this here. Change-Id: Iac662bf73338f9f7669064ed67b960246875c23c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -285,7 +285,7 @@ private:
|
||||
};
|
||||
|
||||
GitDiffEditorController::GitDiffEditorController(IDocument *document, const QString &workingDirectory) :
|
||||
VcsBaseDiffEditorController(document, GitPlugin::client(), workingDirectory),
|
||||
VcsBaseDiffEditorController(document, GitPluginPrivate::client(), workingDirectory),
|
||||
m_watcher(this),
|
||||
m_decorator(&m_watcher)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void GitDiffEditorController::updateBranchList()
|
||||
return;
|
||||
|
||||
const QString workingDirectory = baseDirectory();
|
||||
VcsCommand *command = GitPlugin::client()->vcsExec(
|
||||
VcsCommand *command = GitPluginPrivate::client()->vcsExec(
|
||||
workingDirectory, {"branch", noColorOption, "-a", "--contains", revision}, nullptr,
|
||||
false, 0, workingDirectory);
|
||||
connect(command, &VcsCommand::stdOutText, this, [this](const QString &text) {
|
||||
@@ -376,7 +376,7 @@ QStringList GitDiffEditorController::addHeadWhenCommandInProgress() const
|
||||
// This is workaround for lack of support for merge commits and resolving conflicts,
|
||||
// we compare the current state of working tree to the HEAD of current branch
|
||||
// instead of showing unsupported combined diff format.
|
||||
GitClient::CommandInProgress commandInProgress = GitPlugin::client()->checkCommandInProgress(workingDirectory());
|
||||
GitClient::CommandInProgress commandInProgress = GitPluginPrivate::client()->checkCommandInProgress(workingDirectory());
|
||||
if (commandInProgress != GitClient::NoCommand)
|
||||
return {HEAD};
|
||||
return QStringList();
|
||||
@@ -533,7 +533,7 @@ void ShowController::reload()
|
||||
// stage 1
|
||||
m_state = GettingDescription;
|
||||
const QStringList args = {"show", "-s", noColorOption, showFormatC, m_id};
|
||||
runCommand(QList<QStringList>() << args, GitPlugin::client()->encoding(workingDirectory(), "i18n.commitEncoding"));
|
||||
runCommand(QList<QStringList>() << args, GitPluginPrivate::client()->encoding(workingDirectory(), "i18n.commitEncoding"));
|
||||
setStartupFile(VcsBase::source(document()));
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ void ShowController::processCommandOutput(const QString &output)
|
||||
{
|
||||
QTC_ASSERT(m_state != Idle, return);
|
||||
if (m_state == GettingDescription) {
|
||||
setDescription(GitPlugin::client()->extendedShowDescription(workingDirectory(), output));
|
||||
setDescription(GitPluginPrivate::client()->extendedShowDescription(workingDirectory(), output));
|
||||
// stage 2
|
||||
m_state = GettingDiff;
|
||||
const QStringList args = {"show", "--format=format:", // omit header, already generated
|
||||
@@ -680,7 +680,7 @@ private:
|
||||
{
|
||||
// If interactive rebase editor window is closed, plugin is terminated
|
||||
// but referenced here when the command ends
|
||||
if (GitPlugin *plugin = GitPlugin::instance()) {
|
||||
if (GitPluginPrivate *plugin = GitPluginPrivate::instance()) {
|
||||
GitClient *client = plugin->client();
|
||||
if (m_commit.isEmpty() && m_files.isEmpty()) {
|
||||
if (client->checkCommandInProgress(m_workingDirectory) == GitClient::NoCommand)
|
||||
@@ -1324,7 +1324,7 @@ void GitClient::removeStaleRemoteBranches(const QString &workingDirectory, const
|
||||
VcsCommand::ShowSuccessMessage);
|
||||
|
||||
connect(command, &VcsCommand::success,
|
||||
this, [workingDirectory]() { GitPlugin::instance()->updateBranches(workingDirectory); });
|
||||
this, [workingDirectory]() { GitPluginPrivate::instance()->updateBranches(workingDirectory); });
|
||||
}
|
||||
|
||||
void GitClient::recoverDeletedFiles(const QString &workingDirectory)
|
||||
@@ -2277,7 +2277,7 @@ GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &wo
|
||||
|
||||
void GitClient::continueCommandIfNeeded(const QString &workingDirectory, bool allowContinue)
|
||||
{
|
||||
if (GitPlugin::instance()->isCommitEditorOpen())
|
||||
if (GitPluginPrivate::instance()->isCommitEditorOpen())
|
||||
return;
|
||||
CommandInProgress command = checkCommandInProgress(workingDirectory);
|
||||
ContinueCommandMode continueMode;
|
||||
@@ -2350,7 +2350,7 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory,
|
||||
if (isRebase)
|
||||
rebase(workingDirectory, QLatin1String(hasChanges ? "--continue" : "--skip"));
|
||||
else
|
||||
GitPlugin::instance()->startCommit();
|
||||
GitPluginPrivate::instance()->startCommit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2843,7 +2843,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
|
||||
VcsOutputWindow::appendError(stdErr);
|
||||
GitPlugin::instance()->updateCurrentBranch();
|
||||
GitPluginPrivate::instance()->updateCurrentBranch();
|
||||
return true;
|
||||
} else {
|
||||
VcsOutputWindow::appendError(tr("Cannot commit %n files: %1\n", nullptr, commitCount).arg(stdErr));
|
||||
@@ -2945,7 +2945,7 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
|
||||
QString errorMessage;
|
||||
switch (revertI(files, &isDirectory, &errorMessage, revertStaging)) {
|
||||
case RevertOk:
|
||||
GitPlugin::instance()->gitVersionControl()->emitFilesChanged(files);
|
||||
GitPluginPrivate::instance()->gitVersionControl()->emitFilesChanged(files);
|
||||
break;
|
||||
case RevertCanceled:
|
||||
break;
|
||||
@@ -2966,7 +2966,7 @@ void GitClient::fetch(const QString &workingDirectory, const QString &remote)
|
||||
VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
VcsCommand::ShowSuccessMessage);
|
||||
connect(command, &VcsCommand::success,
|
||||
this, [workingDirectory]() { GitPlugin::instance()->updateBranches(workingDirectory); });
|
||||
this, [workingDirectory]() { GitPluginPrivate::instance()->updateBranches(workingDirectory); });
|
||||
}
|
||||
|
||||
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
@@ -3180,7 +3180,7 @@ void GitClient::push(const QString &workingDirectory, const QStringList &pushArg
|
||||
QStringList({"push", "--force-with-lease"}) + pushArgs,
|
||||
nullptr, true, VcsCommand::ShowSuccessMessage);
|
||||
connect(rePushCommand, &VcsCommand::success,
|
||||
this, []() { GitPlugin::instance()->updateCurrentBranch(); });
|
||||
this, []() { GitPluginPrivate::instance()->updateCurrentBranch(); });
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3201,13 +3201,13 @@ void GitClient::push(const QString &workingDirectory, const QStringList &pushArg
|
||||
fallbackCommandParts.mid(1),
|
||||
nullptr, true, VcsCommand::ShowSuccessMessage);
|
||||
connect(rePushCommand, &VcsCommand::success, this, [workingDirectory]() {
|
||||
GitPlugin::instance()->updateBranches(workingDirectory);
|
||||
GitPluginPrivate::instance()->updateBranches(workingDirectory);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
GitPlugin::instance()->updateCurrentBranch();
|
||||
GitPluginPrivate::instance()->updateCurrentBranch();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3469,7 +3469,7 @@ bool GitClient::StashInfo::init(const QString &workingDirectory, const QString &
|
||||
m_pushAction = pushAction;
|
||||
QString errorMessage;
|
||||
QString statusOutput;
|
||||
switch (GitPlugin::client()->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
|
||||
switch (GitPluginPrivate::client()->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
|
||||
&statusOutput, &errorMessage)) {
|
||||
case GitClient::StatusChanged:
|
||||
if (m_flags & NoPrompt)
|
||||
@@ -3522,14 +3522,14 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st
|
||||
msgBox.exec();
|
||||
|
||||
if (msgBox.clickedButton() == discardButton) {
|
||||
m_stashResult = GitPlugin::client()->synchronousReset(m_workingDir, QStringList(), errorMessage) ?
|
||||
m_stashResult = GitPluginPrivate::client()->synchronousReset(m_workingDir, QStringList(), errorMessage) ?
|
||||
StashUnchanged : StashFailed;
|
||||
} else if (msgBox.clickedButton() == ignoreButton) { // At your own risk, so.
|
||||
m_stashResult = NotStashed;
|
||||
} else if (msgBox.clickedButton() == cancelButton) {
|
||||
m_stashResult = StashCanceled;
|
||||
} else if (msgBox.clickedButton() == stashButton) {
|
||||
const bool result = GitPlugin::client()->executeSynchronousStash(
|
||||
const bool result = GitPluginPrivate::client()->executeSynchronousStash(
|
||||
m_workingDir, creatorStashMessage(command), false, errorMessage);
|
||||
m_stashResult = result ? StashUnchanged : StashFailed;
|
||||
} else if (msgBox.clickedButton() == stashAndPopButton) {
|
||||
@@ -3540,7 +3540,7 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st
|
||||
void GitClient::StashInfo::executeStash(const QString &command, QString *errorMessage)
|
||||
{
|
||||
m_message = creatorStashMessage(command);
|
||||
if (!GitPlugin::client()->executeSynchronousStash(m_workingDir, m_message, false, errorMessage))
|
||||
if (!GitPluginPrivate::client()->executeSynchronousStash(m_workingDir, m_message, false, errorMessage))
|
||||
m_stashResult = StashFailed;
|
||||
else
|
||||
m_stashResult = Stashed;
|
||||
@@ -3563,14 +3563,14 @@ void GitClient::StashInfo::end()
|
||||
{
|
||||
if (m_stashResult == Stashed) {
|
||||
QString stashName;
|
||||
if (GitPlugin::client()->stashNameFromMessage(m_workingDir, m_message, &stashName))
|
||||
GitPlugin::client()->stashPop(m_workingDir, stashName);
|
||||
if (GitPluginPrivate::client()->stashNameFromMessage(m_workingDir, m_message, &stashName))
|
||||
GitPluginPrivate::client()->stashPop(m_workingDir, stashName);
|
||||
}
|
||||
|
||||
if (m_pushAction == NormalPush)
|
||||
GitPlugin::client()->push(m_workingDir);
|
||||
GitPluginPrivate::client()->push(m_workingDir);
|
||||
else if (m_pushAction == PushToGerrit)
|
||||
GitPlugin::instance()->gerritPlugin()->push(m_workingDir);
|
||||
GitPluginPrivate::instance()->gerritPlugin()->push(m_workingDir);
|
||||
|
||||
m_pushAction = NoPush;
|
||||
m_stashResult = NotStashed;
|
||||
|
||||
Reference in New Issue
Block a user