forked from qt-creator/qt-creator
Gerrit: Simplify loop in setRemoteBranches
Change-Id: I9f32080c15ca48a2eb9feb1693eabcc1d8f20dd5 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
53b4da93a2
commit
9fd5c44f4b
@@ -221,22 +221,19 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
bool blocked = m_ui->targetBranchComboBox->blockSignals(true);
|
||||
m_ui->targetBranchComboBox->clear();
|
||||
|
||||
const QString remoteName = selectedRemoteName();
|
||||
int i = 0;
|
||||
bool excluded = false;
|
||||
for (RemoteBranchesMap::const_iterator it = m_remoteBranches.constBegin(),
|
||||
end = m_remoteBranches.constEnd();
|
||||
it != end; ++it) {
|
||||
if (it.key() == selectedRemoteName()) {
|
||||
const BranchDate &bd = it.value();
|
||||
const bool isSuggested = bd.first == m_suggestedRemoteBranch;
|
||||
if (includeOld || bd.second.daysTo(QDate::currentDate()) <= 60 || isSuggested) {
|
||||
m_ui->targetBranchComboBox->addItem(bd.first);
|
||||
if (isSuggested)
|
||||
m_ui->targetBranchComboBox->setCurrentIndex(i);
|
||||
++i;
|
||||
} else {
|
||||
excluded = true;
|
||||
}
|
||||
foreach (const BranchDate &bd, m_remoteBranches.values(remoteName)) {
|
||||
const bool isSuggested = bd.first == m_suggestedRemoteBranch;
|
||||
if (includeOld || isSuggested || !bd.second.isValid()
|
||||
|| bd.second.daysTo(QDate::currentDate()) <= 60) {
|
||||
m_ui->targetBranchComboBox->addItem(bd.first);
|
||||
if (isSuggested)
|
||||
m_ui->targetBranchComboBox->setCurrentIndex(i);
|
||||
++i;
|
||||
} else {
|
||||
excluded = true;
|
||||
}
|
||||
}
|
||||
if (excluded)
|
||||
|
Reference in New Issue
Block a user