forked from qt-creator/qt-creator
Gerrit: Gracefully handle error retrieving branch distance
Change-Id: If4f6babe654a6f667c36ac3afb851b078439d3b6 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
143e23f4d1
commit
bd5afaf4c6
@@ -184,9 +184,9 @@ QString GerritPushDialog::calculateChangeRange(const QString &branch)
|
|||||||
args << QLatin1String("--count");
|
args << QLatin1String("--count");
|
||||||
|
|
||||||
QString number;
|
QString number;
|
||||||
|
QString error;
|
||||||
|
|
||||||
if (!m_client->synchronousRevListCmd(m_workingDir, args, &number))
|
m_client->synchronousRevListCmd(m_workingDir, args, &number, &error);
|
||||||
reject();
|
|
||||||
|
|
||||||
number.chop(1);
|
number.chop(1);
|
||||||
return number;
|
return number;
|
||||||
@@ -201,14 +201,16 @@ void GerritPushDialog::setChangeRange()
|
|||||||
const QString remoteBranchName = selectedRemoteBranchName();
|
const QString remoteBranchName = selectedRemoteBranchName();
|
||||||
if (remoteBranchName.isEmpty())
|
if (remoteBranchName.isEmpty())
|
||||||
return;
|
return;
|
||||||
QString remote = selectedRemoteName();
|
|
||||||
remote += QLatin1Char('/');
|
|
||||||
remote += remoteBranchName;
|
|
||||||
const QString branch = m_ui->localBranchComboBox->currentText();
|
const QString branch = m_ui->localBranchComboBox->currentText();
|
||||||
m_ui->infoLabel->setText(tr("Number of commits between %1 and %2: %3")
|
const QString range = calculateChangeRange(branch);
|
||||||
.arg(branch)
|
if (range.isEmpty()) {
|
||||||
.arg(remote)
|
m_ui->infoLabel->hide();
|
||||||
.arg(calculateChangeRange(branch)));
|
return;
|
||||||
|
}
|
||||||
|
m_ui->infoLabel->show();
|
||||||
|
const QString remote = selectedRemoteName() + QLatin1Char('/') + remoteBranchName;
|
||||||
|
m_ui->infoLabel->setText(
|
||||||
|
tr("Number of commits between %1 and %2: %3").arg(branch, remote, range));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GerritPushDialog::isValid() const
|
bool GerritPushDialog::isValid() const
|
||||||
|
Reference in New Issue
Block a user