11#include "cvsdiffparser.h"
13#include "diffmodellist.h"
14#include "diffparser.h"
15#include "perforceparser.h"
16#include <komparediff2_logging.h>
25Parser::~Parser() =
default;
35 for (; it != diffLines.
end(); ++it) {
36 if ((*it).startsWith(noNewLine)) {
37 it = diffLines.
erase(it);
53 std::unique_ptr<ParserBase> parser;
55 m_generator = determineGenerator(diffLines);
57 int nol = cleanUpCrap(diffLines);
58 qCDebug(KOMPAREDIFF2_LOG) <<
"Cleaned up " << nol <<
" line(s) of crap from the diff...";
60 switch (m_generator) {
62 qCDebug(KOMPAREDIFF2_LOG) <<
"It is a CVS generated diff...";
63 parser = std::make_unique<CVSDiffParser>(m_list, diffLines);
66 qCDebug(KOMPAREDIFF2_LOG) <<
"It is a diff generated diff...";
67 parser = std::make_unique<DiffParser>(m_list, diffLines);
70 qCDebug(KOMPAREDIFF2_LOG) <<
"It is a Perforce generated diff...";
71 parser = std::make_unique<PerforceParser>(m_list, diffLines);
78 m_format = parser->format();
81 qCDebug(KOMPAREDIFF2_LOG) <<
"Modelcount: " << modelList->
count();
82 for (
const DiffModel *model : std::as_const(*modelList)) {
83 qCDebug(KOMPAREDIFF2_LOG) <<
"Hunkcount: " << model->hunkCount();
84 qCDebug(KOMPAREDIFF2_LOG) <<
"Diffcount: " << model->differenceCount();
97 for (
const QString &diffLine : diffLines) {
98 if (diffLine.startsWith(cvsDiff)) {
99 qCDebug(KOMPAREDIFF2_LOG) <<
"Diff is a CVSDiff";
102 if (diffLine.startsWith(perforceDiff)) {
103 qCDebug(KOMPAREDIFF2_LOG) <<
"Diff is a Perforce Diff";
108 qCDebug(KOMPAREDIFF2_LOG) <<
"We'll assume it is a diff Diff";
A model describing the differences between two files.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
Generator
Patch generator enum.
qsizetype count() const const
iterator erase(const_iterator begin, const_iterator end)