Git: Partially move plugin pimpl to .cpp

Same procedure as for ClearCase.
Unfortuately, some deep accesses are not easy to get rid of. Make them
available by static functions in the plugin itself. Definitely not the
favorite setup, but allows to proceed with the QObject removals.

Change-Id: Id85ed07bc7a6c1c053431a14dd7f68892f7ebea0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2020-02-07 11:24:32 +01:00
parent 4e357e84c0
commit eb1226df68
21 changed files with 377 additions and 345 deletions

View File

@@ -148,7 +148,7 @@ FetchContext::FetchContext(const QSharedPointer<GerritChange> &change,
connect(&m_watcher, &QFutureWatcher<void>::canceled, this, &FetchContext::terminate);
m_watcher.setFuture(m_progress.future());
m_process.setWorkingDirectory(repository);
m_process.setProcessEnvironment(GitPluginPrivate::client()->processEnvironment());
m_process.setProcessEnvironment(GitPlugin::client()->processEnvironment());
m_process.closeWriteChannel();
}
@@ -240,7 +240,7 @@ void FetchContext::show()
{
const QString title = QString::number(m_change->number) + '/'
+ QString::number(m_change->currentPatchSet.patchSetNumber);
GitPluginPrivate::client()->show(m_repository, "FETCH_HEAD", title);
GitPlugin::client()->show(m_repository, "FETCH_HEAD", title);
}
void FetchContext::cherryPick()
@@ -248,12 +248,12 @@ void FetchContext::cherryPick()
// Point user to errors.
VcsBase::VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch
| IOutputPane::WithFocus);
GitPluginPrivate::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
GitPlugin::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
}
void FetchContext::checkout()
{
GitPluginPrivate::client()->checkout(m_repository, "FETCH_HEAD");
GitPlugin::client()->checkout(m_repository, "FETCH_HEAD");
}
void FetchContext::terminate()
@@ -328,12 +328,12 @@ void GerritPlugin::push(const QString &topLevel)
dialog.storeTopic();
m_reviewers = dialog.reviewers();
GitPluginPrivate::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
}
static QString currentRepository()
{
return GitPluginPrivate::instance()->currentState().topLevel();
return GitPlugin::currentState().topLevel();
}
// Open or raise the Gerrit dialog window.
@@ -375,19 +375,19 @@ void GerritPlugin::push()
Utils::FilePath GerritPlugin::gitBinDirectory()
{
return GitPluginPrivate::client()->gitBinDirectory();
return GitPlugin::client()->gitBinDirectory();
}
// Find the branch of a repository.
QString GerritPlugin::branch(const QString &repository)
{
return GitPluginPrivate::client()->synchronousCurrentLocalBranch(repository);
return GitPlugin::client()->synchronousCurrentLocalBranch(repository);
}
void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
{
// Locate git.
const Utils::FilePath git = GitPluginPrivate::client()->vcsBinary();
const Utils::FilePath git = GitPlugin::client()->vcsBinary();
if (git.isEmpty()) {
VcsBase::VcsOutputWindow::appendError(tr("Git is not available."));
return;
@@ -400,7 +400,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
if (!repository.isEmpty()) {
// Check if remote from a working dir is the same as remote from patch
QMap<QString, QString> remotesList = GitPluginPrivate::client()->synchronousRemotesList(repository);
QMap<QString, QString> remotesList = GitPlugin::client()->synchronousRemotesList(repository);
if (!remotesList.isEmpty()) {
const QStringList remotes = remotesList.values();
for (QString remote : remotes) {
@@ -413,7 +413,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
}
if (!verifiedRepository) {
const SubmoduleDataMap submodules = GitPluginPrivate::client()->submoduleList(repository);
const SubmoduleDataMap submodules = GitPlugin::client()->submoduleList(repository);
for (const SubmoduleData &submoduleData : submodules) {
QString remote = submoduleData.url;
if (remote.endsWith(".git"))
@@ -472,7 +472,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
// Try to find a matching repository for a project by asking the VcsManager.
QString GerritPlugin::findLocalRepository(QString project, const QString &branch) const
{
const QStringList gitRepositories = VcsManager::repositories(GitPluginPrivate::instance());
const QStringList gitRepositories = VcsManager::repositories(GitPlugin::versionControl());
// Determine key (file name) to look for (qt/qtbase->'qtbase').
const int slashPos = project.lastIndexOf('/');
if (slashPos != -1)