forked from qt-creator/qt-creator
Gerrit: Fix wrong references in REST parsing
* Fetch url/ref * Patch set number Change-Id: I1aec8850add21dc269326c637b246ba62266b889 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
42333ec1d2
commit
16d2a10a1b
@@ -737,10 +737,15 @@ static GerritChangePtr parseSshOutput(const QJsonObject &object)
|
||||
}
|
||||
*/
|
||||
|
||||
static int restNumberValue(const QJsonObject &object)
|
||||
{
|
||||
return object.value("_number").toInt();
|
||||
}
|
||||
|
||||
static GerritChangePtr parseRestOutput(const QJsonObject &object, const GerritServer &server)
|
||||
{
|
||||
GerritChangePtr change(new GerritChange);
|
||||
change->number = object.value("_number").toInt();
|
||||
change->number = restNumberValue(object);
|
||||
change->url = QString("%1/%2").arg(server.url()).arg(change->number);
|
||||
change->title = object.value("subject").toString();
|
||||
change->owner = parseGerritUser(object.value("owner").toObject());
|
||||
@@ -751,10 +756,11 @@ static GerritChangePtr parseRestOutput(const QJsonObject &object, const GerritSe
|
||||
Qt::DateFormat::ISODate).toLocalTime();
|
||||
// Read current patch set.
|
||||
const QJsonObject patchSet = object.value("revisions").toObject().begin().value().toObject();
|
||||
change->currentPatchSet.patchSetNumber = qMax(1, patchSet.value("number").toString().toInt());
|
||||
change->currentPatchSet.ref = patchSet.value("ref").toString();
|
||||
change->currentPatchSet.patchSetNumber = qMax(1, restNumberValue(patchSet));
|
||||
const QJsonObject fetchInfo = patchSet.value("fetch").toObject().value("http").toObject();
|
||||
change->currentPatchSet.ref = fetchInfo.value("ref").toString();
|
||||
// Replace * in ssh://*:29418/qt-creator/qt-creator with the hostname
|
||||
change->currentPatchSet.url = patchSet.value("url").toString().replace('*', server.host);
|
||||
change->currentPatchSet.url = fetchInfo.value("url").toString().replace('*', server.host);
|
||||
const QJsonObject labels = object.value("labels").toObject();
|
||||
for (auto it = labels.constBegin(), end = labels.constEnd(); it != end; ++it) {
|
||||
const QJsonArray all = it.value().toObject().value("all").toArray();
|
||||
|
||||
Reference in New Issue
Block a user