diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2017-09-10 15:37:50 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2017-09-11 09:49:41 +0000 |
commit | 3b4c6ed5bd25cd6585bbb7ce5db07d6086b99e29 (patch) | |
tree | e39aaa9007b5047a66a4609af73c365d6d3d675f /src/plugins | |
parent | 8037d5e02f510446dfe3661b72057fb5d782b998 (diff) | |
download | qt-creator-3b4c6ed5bd25cd6585bbb7ce5db07d6086b99e29.tar.gz |
PushToGerrit: Fix support for multiple projects on the same remote
Use case: A project has a legacy repo and a new repo. Both are used as
remotes in the same local directory. If the legacy repo's remote name is
less than the current repo (legacy < origin) then only legacy appears.
Change-Id: Ie02cbee3142c4d2628cb51cbcad50cf903a75bb0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/git/gerrit/gerritpushdialog.cpp | 2 | ||||
-rw-r--r-- | src/plugins/git/gerrit/gerritremotechooser.cpp | 13 | ||||
-rw-r--r-- | src/plugins/git/gerrit/gerritremotechooser.h | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp index 4f8585b679..d293373e0b 100644 --- a/src/plugins/git/gerrit/gerritpushdialog.cpp +++ b/src/plugins/git/gerrit/gerritpushdialog.cpp @@ -26,7 +26,6 @@ #include "gerritpushdialog.h" #include "ui_gerritpushdialog.h" #include "branchcombobox.h" -#include "gerritserver.h" #include "../gitplugin.h" #include "../gitclient.h" @@ -129,6 +128,7 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev m_ui->repositoryLabel->setText(QDir::toNativeSeparators(workingDir)); m_ui->remoteComboBox->setRepository(workingDir); m_ui->remoteComboBox->setParameters(parameters); + m_ui->remoteComboBox->setAllowDups(true); PushItemDelegate *delegate = new PushItemDelegate(m_ui->commitView); delegate->setParent(this); diff --git a/src/plugins/git/gerrit/gerritremotechooser.cpp b/src/plugins/git/gerrit/gerritremotechooser.cpp index 06b916c16f..b5cf6e9f02 100644 --- a/src/plugins/git/gerrit/gerritremotechooser.cpp +++ b/src/plugins/git/gerrit/gerritremotechooser.cpp @@ -80,6 +80,11 @@ void GerritRemoteChooser::setFallbackEnabled(bool value) m_enableFallback = value; } +void GerritRemoteChooser::setAllowDups(bool value) +{ + m_allowDups = value; +} + bool GerritRemoteChooser::setCurrentRemote(const QString &remoteName) { for (int i = 0, total = m_remoteComboBox->count(); i < total; ++i) { @@ -118,9 +123,11 @@ bool GerritRemoteChooser::updateRemotes(bool forceReload) void GerritRemoteChooser::addRemote(const GerritServer &server, const QString &name) { - for (auto remote : m_remotes) { - if (remote.second == server) - return; + if (!m_allowDups) { + for (auto remote : m_remotes) { + if (remote.second == server) + return; + } } m_remoteComboBox->addItem(server.host + QString(" (%1)").arg(name)); m_remotes.push_back({ name, server }); diff --git a/src/plugins/git/gerrit/gerritremotechooser.h b/src/plugins/git/gerrit/gerritremotechooser.h index c06013bb22..c2dacf84cf 100644 --- a/src/plugins/git/gerrit/gerritremotechooser.h +++ b/src/plugins/git/gerrit/gerritremotechooser.h @@ -48,6 +48,7 @@ public: void setRepository(const QString &repository); void setParameters(QSharedPointer<GerritParameters> parameters); void setFallbackEnabled(bool value); + void setAllowDups(bool value); bool setCurrentRemote(const QString &remoteName); bool updateRemotes(bool forceReload); @@ -68,6 +69,7 @@ private: QToolButton *m_resetRemoteButton = nullptr; bool m_updatingRemotes = false; bool m_enableFallback = false; + bool m_allowDups = false; using NameAndServer = std::pair<QString, GerritServer>; std::vector<NameAndServer> m_remotes; }; |