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>
This commit is contained in:
Orgad Shaneh
2017-09-10 15:37:50 +03:00
committed by Orgad Shaneh
parent 8037d5e02f
commit 3b4c6ed5bd
3 changed files with 13 additions and 4 deletions

View File

@@ -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 });