aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gerrit
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-02-07 11:24:32 +0100
committerhjk <hjk@qt.io>2020-02-07 12:56:10 +0000
commiteb1226df68edb2180425fda8411f57aab06c7b5f (patch)
tree83cab0eb431c1bf50efe9672da473f22caced496 /src/plugins/git/gerrit
parent4e357e84c03c629a284c1f5505908f8a7644fba9 (diff)
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>
Diffstat (limited to 'src/plugins/git/gerrit')
-rw-r--r--src/plugins/git/gerrit/branchcombobox.cpp4
-rw-r--r--src/plugins/git/gerrit/gerritdialog.cpp2
-rw-r--r--src/plugins/git/gerrit/gerritmodel.cpp2
-rw-r--r--src/plugins/git/gerrit/gerritplugin.cpp24
-rw-r--r--src/plugins/git/gerrit/gerritpushdialog.cpp14
-rw-r--r--src/plugins/git/gerrit/gerritremotechooser.cpp2
-rw-r--r--src/plugins/git/gerrit/gerritserver.cpp4
7 files changed, 26 insertions, 26 deletions
diff --git a/src/plugins/git/gerrit/branchcombobox.cpp b/src/plugins/git/gerrit/branchcombobox.cpp
index 6505066a3b2..6cc866ce3f1 100644
--- a/src/plugins/git/gerrit/branchcombobox.cpp
+++ b/src/plugins/git/gerrit/branchcombobox.cpp
@@ -36,7 +36,7 @@ BranchComboBox::BranchComboBox(QWidget *parent) : QComboBox(parent)
void BranchComboBox::init(const QString &repository)
{
m_repository = repository;
- QString currentBranch = GitPluginPrivate::client()->synchronousCurrentLocalBranch(repository);
+ QString currentBranch = GitPlugin::client()->synchronousCurrentLocalBranch(repository);
if (currentBranch.isEmpty()) {
m_detached = true;
currentBranch = "HEAD";
@@ -44,7 +44,7 @@ void BranchComboBox::init(const QString &repository)
}
QString output;
const QString branchPrefix("refs/heads/");
- if (!GitPluginPrivate::client()->synchronousForEachRefCmd(
+ if (!GitPlugin::client()->synchronousForEachRefCmd(
m_repository, {"--format=%(refname)", branchPrefix}, &output)) {
return;
}
diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp
index 26babec2a1a..402c29763a1 100644
--- a/src/plugins/git/gerrit/gerritdialog.cpp
+++ b/src/plugins/git/gerrit/gerritdialog.cpp
@@ -139,7 +139,7 @@ void GerritDialog::setCurrentPath(const QString &path)
if (path == m_repository)
return;
m_repository = path;
- m_ui->repositoryLabel->setText(Git::Internal::GitPluginPrivate::msgRepositoryLabel(path));
+ m_ui->repositoryLabel->setText(Git::Internal::GitPlugin::msgRepositoryLabel(path));
updateRemotes();
}
diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp
index 694e25dc913..a9be6358ccb 100644
--- a/src/plugins/git/gerrit/gerritmodel.cpp
+++ b/src/plugins/git/gerrit/gerritmodel.cpp
@@ -295,7 +295,7 @@ QueryContext::QueryContext(const QString &query,
connect(&m_process, &QProcess::errorOccurred, this, &QueryContext::processError);
connect(&m_watcher, &QFutureWatcherBase::canceled, this, &QueryContext::terminate);
m_watcher.setFuture(m_progress.future());
- m_process.setProcessEnvironment(Git::Internal::GitPluginPrivate::client()->processEnvironment());
+ m_process.setProcessEnvironment(Git::Internal::GitPlugin::client()->processEnvironment());
m_progress.setProgressRange(0, 1);
m_timer.setInterval(timeOutMS);
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index 598a6fb75d1..656f1e34f70 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -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)
diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp
index 305581ae40b..9a251b5eda1 100644
--- a/src/plugins/git/gerrit/gerritpushdialog.cpp
+++ b/src/plugins/git/gerrit/gerritpushdialog.cpp
@@ -70,7 +70,7 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
QString output;
QString error;
- if (!GitPluginPrivate::client()->synchronousBranchCmd(
+ if (!GitPlugin::client()->synchronousBranchCmd(
m_workingDir, {"-r", "--contains", earliestCommit + '^'}, &output, &error)) {
return QString();
}
@@ -79,7 +79,7 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
QString remoteTrackingBranch;
if (localBranch != "HEAD")
- remoteTrackingBranch = GitPluginPrivate::client()->synchronousTrackingBranch(m_workingDir, localBranch);
+ remoteTrackingBranch = GitPlugin::client()->synchronousTrackingBranch(m_workingDir, localBranch);
QString remoteBranch;
for (const QString &reference : refs) {
@@ -103,7 +103,7 @@ void GerritPushDialog::initRemoteBranches()
const QString head = "/HEAD";
QString remotesPrefix("refs/remotes/");
- if (!GitPluginPrivate::client()->synchronousForEachRefCmd(
+ if (!GitPlugin::client()->synchronousForEachRefCmd(
m_workingDir, {"--format=%(refname)\t%(committerdate:raw)", remotesPrefix}, &output)) {
return;
}
@@ -187,7 +187,7 @@ QString GerritPushDialog::calculateChangeRange(const QString &branch)
QString number;
QString error;
- GitPluginPrivate::client()->synchronousRevListCmd(m_workingDir, { remote + ".." + branch, "--count" },
+ GitPlugin::client()->synchronousRevListCmd(m_workingDir, { remote + ".." + branch, "--count" },
&number, &error);
number.chop(1);
@@ -304,7 +304,7 @@ QString GerritPushDialog::pushTarget() const
void GerritPushDialog::storeTopic()
{
const QString branch = m_ui->localBranchComboBox->currentText();
- GitPluginPrivate::client()->setConfigValue(m_workingDir, QString("branch.%1.topic").arg(branch),
+ GitPlugin::client()->setConfigValue(m_workingDir, QString("branch.%1.topic").arg(branch),
selectedTopic());
}
@@ -317,7 +317,7 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
const QString remoteName = selectedRemoteName();
if (!m_remoteBranches.contains(remoteName)) {
const QStringList remoteBranches =
- GitPluginPrivate::client()->synchronousRepositoryBranches(remoteName, m_workingDir);
+ GitPlugin::client()->synchronousRepositoryBranches(remoteName, m_workingDir);
for (const QString &branch : remoteBranches)
m_remoteBranches.insertMulti(remoteName, qMakePair(branch, QDate()));
if (remoteBranches.isEmpty()) {
@@ -355,7 +355,7 @@ void GerritPushDialog::updateCommits(int index)
{
const QString branch = m_ui->localBranchComboBox->itemText(index);
m_hasLocalCommits = m_ui->commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
- QString topic = GitPluginPrivate::client()->readConfigValue(
+ QString topic = GitPlugin::client()->readConfigValue(
m_workingDir, QString("branch.%1.topic").arg(branch));
if (!topic.isEmpty())
m_ui->topicLineEdit->setText(topic);
diff --git a/src/plugins/git/gerrit/gerritremotechooser.cpp b/src/plugins/git/gerrit/gerritremotechooser.cpp
index f7c4d779a68..8e5e7cd8828 100644
--- a/src/plugins/git/gerrit/gerritremotechooser.cpp
+++ b/src/plugins/git/gerrit/gerritremotechooser.cpp
@@ -104,7 +104,7 @@ bool GerritRemoteChooser::updateRemotes(bool forceReload)
m_remotes.clear();
QString errorMessage; // Mute errors. We'll just fallback to the defaults
const QMap<QString, QString> remotesList =
- Git::Internal::GitPluginPrivate::client()->synchronousRemotesList(m_repository, &errorMessage);
+ Git::Internal::GitPlugin::client()->synchronousRemotesList(m_repository, &errorMessage);
for (auto mapIt = remotesList.cbegin(), end = remotesList.cend(); mapIt != end; ++mapIt) {
GerritServer server;
if (!server.fillFromRemote(mapIt.value(), *m_parameters, forceReload))
diff --git a/src/plugins/git/gerrit/gerritserver.cpp b/src/plugins/git/gerrit/gerritserver.cpp
index c47cd281f30..f642b1f9d68 100644
--- a/src/plugins/git/gerrit/gerritserver.cpp
+++ b/src/plugins/git/gerrit/gerritserver.cpp
@@ -240,7 +240,7 @@ QStringList GerritServer::curlArguments() const
int GerritServer::testConnection()
{
- static GitClient *const client = GitPluginPrivate::client();
+ static GitClient *const client = GitPlugin::client();
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), {curlBinary, arguments},
@@ -332,7 +332,7 @@ bool GerritServer::resolveRoot()
void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
{
- static GitClient *const client = GitPluginPrivate::client();
+ static GitClient *const client = GitPlugin::client();
QSettings *settings = Core::ICore::settings();
const QString fullVersionKey = "Gerrit/" + host + '/' + versionKey;
version = settings->value(fullVersionKey).toString();