Gerrit: Use magic branch options to specify reviewers

Enables specifying reviewers over http[s].

Supported since gerrit 2.6 (specifying reviewers will be broken for
earlier versions).

Prepare for supporting other options (draft, publish, topic...)

Change-Id: Id0b6508409123cddb9dec5ea9e78d7a6a1423057
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Orgad Shaneh
2014-06-15 11:04:51 +03:00
committed by Orgad Shaneh
parent caef827cd7
commit 49b0b5d3eb

View File

@@ -326,16 +326,6 @@ void GerritPlugin::push(const QString &topLevel)
QStringList args;
m_reviewers = dialog.reviewers();
const QStringList reviewers = m_reviewers.split(QLatin1Char(','), QString::SkipEmptyParts);
if (!reviewers.isEmpty()) {
QString reviewersFlag(QLatin1String("--receive-pack=git receive-pack"));
foreach (const QString &reviewer, reviewers) {
const QString name = reviewer.trimmed();
if (!name.isEmpty())
reviewersFlag += QString::fromLatin1(" --reviewer=") + name;
}
args << reviewersFlag;
}
args << dialog.selectedRemoteName();
QString target = dialog.selectedCommit();
@@ -346,6 +336,15 @@ void GerritPlugin::push(const QString &topLevel)
const QString topic = dialog.selectedTopic();
if (!topic.isEmpty())
target += QLatin1Char('/') + topic;
QStringList options;
const QStringList reviewers = m_reviewers.split(QLatin1Char(','), QString::SkipEmptyParts);
foreach (const QString &reviewer, reviewers)
options << QLatin1String("r=") + reviewer;
if (!options.isEmpty())
target += QLatin1Char('%') + options.join(QLatin1String(","));
args << target;
gitClient()->push(topLevel, args);