diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp index 17e36c4fd25..622da381793 100644 --- a/src/plugins/git/gerrit/gerritpushdialog.cpp +++ b/src/plugins/git/gerrit/gerritpushdialog.cpp @@ -32,7 +32,9 @@ #include "../gitconstants.h" #include +#include +#include #include #include #include @@ -44,6 +46,8 @@ using namespace Git::Internal; namespace Gerrit { namespace Internal { +static const int ReasonableDistance = 100; + class PushItemDelegate : public IconItemDelegate { public: @@ -207,8 +211,18 @@ void GerritPushDialog::setChangeRange() } m_ui->infoLabel->show(); const QString remote = selectedRemoteName() + '/' + remoteBranchName; - m_ui->infoLabel->setText( - tr("Number of commits between %1 and %2: %3").arg(branch, remote, range)); + QString labelText = tr("Number of commits between %1 and %2: %3").arg(branch, remote, range); + const int currentRange = range.toInt(); + QPalette palette = QApplication::palette(); + if (currentRange > ReasonableDistance) { + const QColor errorColor = Utils::creatorTheme()->color(Utils::Theme::TextColorError); + palette.setColor(QPalette::Foreground, errorColor); + palette.setColor(QPalette::ButtonText, errorColor); + labelText.append("\n" + tr("Are you sure you selected the right target branch?")); + } + m_ui->infoLabel->setPalette(palette); + m_ui->targetBranchComboBox->setPalette(palette); + m_ui->infoLabel->setText(labelText); } static bool versionSupportsWip(const QString &version)