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:
Orgad Shaneh
2017-10-14 23:40:05 +03:00
committed by Orgad Shaneh
parent 7a04014f9f
commit c19c2551fb
3 changed files with 23 additions and 25 deletions

View File

@@ -328,25 +328,7 @@ void GerritPlugin::push(const QString &topLevel)
dialog.storeTopic();
m_reviewers = dialog.reviewers();
QString target = dialog.selectedCommit();
if (target.isEmpty())
target = "HEAD";
target += ":refs/" + dialog.selectedPushType() +
'/' + dialog.selectedRemoteBranchName();
const QString topic = dialog.selectedTopic();
if (!topic.isEmpty())
target += '/' + topic;
QStringList options;
const QStringList reviewers = m_reviewers.split(',', QString::SkipEmptyParts);
for (const QString &reviewer : reviewers)
options << "r=" + reviewer;
if (!options.isEmpty())
target += '%' + options.join(',');
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), target});
GitPlugin::client()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
}
// Open or raise the Gerrit dialog window.