forked from qt-creator/qt-creator
Gerrit: Move push target logic to GerritPushDialog
Less indirection + will simplify new private/wip flags. Change-Id: If8c4072b6456b4044d83ef17e130e0360a1d05f8 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
7a04014f9f
commit
c19c2551fb
@@ -214,6 +214,27 @@ QString GerritPushDialog::initErrorMessage() const
|
||||
return m_initErrorMessage;
|
||||
}
|
||||
|
||||
QString GerritPushDialog::pushTarget() const
|
||||
{
|
||||
QString target = selectedCommit();
|
||||
if (target.isEmpty())
|
||||
target = "HEAD";
|
||||
target += ":refs/" + QLatin1String(m_ui->draftCheckBox->isChecked() ? "drafts" : "for") +
|
||||
'/' + selectedRemoteBranchName();
|
||||
const QString topic = selectedTopic();
|
||||
if (!topic.isEmpty())
|
||||
target += '/' + topic;
|
||||
|
||||
QStringList options;
|
||||
const QStringList reviewersInput = reviewers().split(',', QString::SkipEmptyParts);
|
||||
for (const QString &reviewer : reviewersInput)
|
||||
options << "r=" + reviewer;
|
||||
|
||||
if (!options.isEmpty())
|
||||
target += '%' + options.join(',');
|
||||
return target;
|
||||
}
|
||||
|
||||
void GerritPushDialog::storeTopic()
|
||||
{
|
||||
const QString branch = m_ui->localBranchComboBox->currentText();
|
||||
@@ -302,11 +323,6 @@ QString GerritPushDialog::selectedRemoteBranchName() const
|
||||
return m_ui->targetBranchComboBox->currentText();
|
||||
}
|
||||
|
||||
QString GerritPushDialog::selectedPushType() const
|
||||
{
|
||||
return QLatin1String(m_ui->draftCheckBox->isChecked() ? "drafts" : "for");
|
||||
}
|
||||
|
||||
QString GerritPushDialog::selectedTopic() const
|
||||
{
|
||||
return m_ui->topicLineEdit->text().trimmed();
|
||||
|
Reference in New Issue
Block a user