Git: Eradicate Q_FOREACH loops

Change-Id: I29b6071ea244d1b3ae0701d36c90b1e93cf21fbb
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2017-02-04 23:08:17 +02:00
committed by Orgad Shaneh
parent e3eee3b2b9
commit e366e135b7
17 changed files with 86 additions and 62 deletions

View File

@@ -70,14 +70,14 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
return QString();
}
const QString head = "/HEAD";
QStringList refs = output.split('\n');
const QStringList refs = output.split('\n');
QString remoteTrackingBranch;
if (localBranch != "HEAD")
remoteTrackingBranch = GitPlugin::client()->synchronousTrackingBranch(m_workingDir, localBranch);
QString remoteBranch;
foreach (const QString &reference, refs) {
for (const QString &reference : refs) {
const QString ref = reference.trimmed();
if (ref.contains(head) || ref.isEmpty())
continue;
@@ -104,7 +104,7 @@ void GerritPushDialog::initRemoteBranches()
}
const QStringList refs = output.split("\n");
foreach (const QString &reference, refs) {
for (const QString &reference : refs) {
QStringList entries = reference.split('\t');
if (entries.count() < 2 || entries.first().endsWith(head))
continue;
@@ -237,7 +237,7 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
if (!m_remoteBranches.contains(remoteName)) {
const QStringList remoteBranches =
GitPlugin::client()->synchronousRepositoryBranches(remoteName, m_workingDir);
foreach (const QString &branch, remoteBranches)
for (const QString &branch : remoteBranches)
m_remoteBranches.insertMulti(remoteName, qMakePair(branch, QDate()));
if (remoteBranches.isEmpty()) {
m_ui->targetBranchComboBox->setEditable(true);
@@ -250,7 +250,8 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
int i = 0;
bool excluded = false;
foreach (const BranchDate &bd, m_remoteBranches.values(remoteName)) {
const QList<BranchDate> remoteBranches = m_remoteBranches.values(remoteName);
for (const BranchDate &bd : remoteBranches) {
const bool isSuggested = bd.first == m_suggestedRemoteBranch;
if (includeOld || isSuggested || !bd.second.isValid()
|| bd.second.daysTo(QDate::currentDate()) <= Git::Constants::OBSOLETE_COMMIT_AGE_IN_DAYS) {