| 487 | } |
| 488 | |
| 489 | QList<QVariant> PerforcePlugin::getQvariantFromLogOutput(QStringList const& outputLines) |
| 490 | { |
| 491 | const QString LOGENTRY_START(QStringLiteral("... #")); |
| 492 | const QString DEPOTMESSAGE_START(QStringLiteral("... .")); |
| 493 | QMap<int, VcsEvent> changes; |
| 494 | QList<QVariant> commits; |
| 495 | QString currentFileName; |
| 496 | QString changeNumberStr, author,changeDescription, commitMessage; |
| 497 | VcsEvent currentVcsEvent; |
| 498 | VcsItemEvent currentRepoFile; |
| 499 | VcsRevision rev; |
| 500 | int indexofAt; |
| 501 | int changeNumber = 0; |
| 502 | |
| 503 | for (const QString& line : outputLines) { |
| 504 | if (!line.startsWith(LOGENTRY_START) && !line.startsWith(DEPOTMESSAGE_START) |
| 505 | && !line.startsWith(QLatin1Char('\t'))) { |
| 506 | currentFileName = line; |
| 507 | } |
| 508 | if(line.indexOf(LOGENTRY_START) != -1) |
| 509 | { |
| 510 | // expecting the Logentry line to be of the form: |
| 511 | //... #5 change 10 edit on 2010/12/06 12:07:31 by mvo@testbed (text) |
| 512 | changeNumberStr = line.section(QLatin1Char(' '), 3, 3); // We use global change number |
| 513 | changeNumber = changeNumberStr.toInt(); |
| 514 | author = line.section(QLatin1Char(' '), 9, 9); |
| 515 | changeDescription = line.section(QLatin1Char(' '), 4, 4); |
| 516 | indexofAt = author.indexOf(QLatin1Char('@')); |
| 517 | author.remove(indexofAt, author.size()); // Only keep the username itself |
| 518 | rev.setRevisionValue(changeNumberStr, KDevelop::VcsRevision::GlobalNumber); |
| 519 | |
| 520 | changes[changeNumber].setRevision(rev); |
| 521 | changes[changeNumber].setAuthor(author); |
| 522 | changes[changeNumber].setDate( |
| 523 | QDateTime::fromString(line.section(QLatin1Char(' '), 6, 7), QStringLiteral("yyyy/MM/dd hh:mm:ss"))); |
| 524 | currentRepoFile.setRepositoryLocation(currentFileName); |
| 525 | currentRepoFile.setActions( actionsFromString(changeDescription) ); |
| 526 | changes[changeNumber].addItem(currentRepoFile); |
| 527 | commitMessage.clear(); // We have a new entry, clear message |
| 528 | } |
| 529 | if (line.startsWith(QLatin1Char('\t')) || line.startsWith(DEPOTMESSAGE_START)) { |
| 530 | commitMessage += line.trimmed() + QLatin1Char('\n'); |
| 531 | changes[changeNumber].setMessage(commitMessage); |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | for (const auto& item : std::as_const(changes)) { |
| 536 | commits.prepend(QVariant::fromValue(item)); |
| 537 | } |
| 538 | return commits; |
| 539 | } |
| 540 | |
| 541 | void PerforcePlugin::parseP4StatusOutput(DVcsJob* job) |
| 542 | { |
nothing calls this directly
no test coverage detected