summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2018-01-06 22:28:05 +0200
committerOrgad Shaneh <orgads@gmail.com>2018-01-08 08:13:48 +0000
commit1decef8fc98e156338d9a558bd089dcd1224c414 (patch)
treeeacb55f7ab0cfff71fc3f9d1302c56a4b026820b
parente9cbb83b46a00ad729bad3094991652744534f89 (diff)
downloadqt-creator-1decef8fc98e156338d9a558bd089dcd1224c414.tar.gz
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>
-rw-r--r--src/plugins/git/gerrit/gerritplugin.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index ba644b6530..e495ff5748 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -349,6 +349,11 @@ void GerritPlugin::push(const QString &topLevel)
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), target});
}
+static QString currentRepository()
+{
+ return GitPlugin::instance()->currentState().topLevel();
+}
+
// Open or raise the Gerrit dialog window.
void GerritPlugin::openView()
{
@@ -359,8 +364,7 @@ void GerritPlugin::openView()
if (!ICore::showOptionsDialog("Gerrit"))
return;
}
- const QString repository = GitPlugin::instance()->currentState().topLevel();
- GerritDialog *gd = new GerritDialog(m_parameters, m_server, repository, ICore::mainWindow());
+ GerritDialog *gd = new GerritDialog(m_parameters, m_server, currentRepository(), ICore::mainWindow());
gd->setModal(false);
connect(gd, &GerritDialog::fetchDisplay, this,
[this](const QSharedPointer<GerritChange> &change) { fetch(change, FetchDisplay); });
@@ -383,7 +387,7 @@ void GerritPlugin::openView()
void GerritPlugin::push()
{
- push(GitPlugin::instance()->currentState().topLevel());
+ push(currentRepository());
}
Utils::FileName GerritPlugin::gitBinDirectory()