Gerrit: Deduplicate detection of current repository

Change-Id: Ib3a63f71dd45c45b20eab51a2a0bf9c21ba8754a
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Orgad Shaneh
2018-01-06 22:28:05 +02:00
committed by Orgad Shaneh
parent e9cbb83b46
commit 1decef8fc9

View File

@@ -349,6 +349,11 @@ void GerritPlugin::push(const QString &topLevel)
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), target}); GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), target});
} }
static QString currentRepository()
{
return GitPlugin::instance()->currentState().topLevel();
}
// Open or raise the Gerrit dialog window. // Open or raise the Gerrit dialog window.
void GerritPlugin::openView() void GerritPlugin::openView()
{ {
@@ -359,8 +364,7 @@ void GerritPlugin::openView()
if (!ICore::showOptionsDialog("Gerrit")) if (!ICore::showOptionsDialog("Gerrit"))
return; return;
} }
const QString repository = GitPlugin::instance()->currentState().topLevel(); GerritDialog *gd = new GerritDialog(m_parameters, m_server, currentRepository(), ICore::mainWindow());
GerritDialog *gd = new GerritDialog(m_parameters, m_server, repository, ICore::mainWindow());
gd->setModal(false); gd->setModal(false);
connect(gd, &GerritDialog::fetchDisplay, this, connect(gd, &GerritDialog::fetchDisplay, this,
[this](const QSharedPointer<GerritChange> &change) { fetch(change, FetchDisplay); }); [this](const QSharedPointer<GerritChange> &change) { fetch(change, FetchDisplay); });
@@ -383,7 +387,7 @@ void GerritPlugin::openView()
void GerritPlugin::push() void GerritPlugin::push()
{ {
push(GitPlugin::instance()->currentState().topLevel()); push(currentRepository());
} }
Utils::FileName GerritPlugin::gitBinDirectory() Utils::FileName GerritPlugin::gitBinDirectory()