Commit b4d0a1de authored by Volker Krause's avatar Volker Krause
Browse files

Port diff format detection to QRegularExpression

parent d1d8c443
......@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "cvsdiffparser.h"
#include <QRegExp>
#include <QRegularExpression>
#include <komparediffdebug.h>
#include "komparemodellist.h"
......@@ -31,11 +31,11 @@ enum Kompare::Format CVSDiffParser::determineFormat()
{
// qCDebug(LIBKOMPAREDIFF2) << "Determining the format of the CVSDiff";
QRegExp normalRE(QStringLiteral("[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"));
QRegExp unifiedRE(QStringLiteral("^--- [^\\t]+\\t"));
QRegExp contextRE(QStringLiteral("^\\*\\*\\* [^\\t]+\\t"));
QRegExp rcsRE(QStringLiteral("^[acd][0-9]+ [0-9]+"));
QRegExp edRE(QStringLiteral("^[0-9]+[0-9,]*[acd]"));
QRegularExpression normalRE(QStringLiteral("[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"));
QRegularExpression unifiedRE(QStringLiteral("^--- [^\\t]+\\t"));
QRegularExpression contextRE(QStringLiteral("^\\*\\*\\* [^\\t]+\\t"));
QRegularExpression rcsRE(QStringLiteral("^[acd][0-9]+ [0-9]+"));
QRegularExpression edRE(QStringLiteral("^[0-9]+[0-9,]*[acd]"));
QStringList::ConstIterator it = m_diffLines.begin();
......
......@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "diffparser.h"
#include <QRegExp>
#include <QRegularExpression>
#include <komparediffdebug.h>
......@@ -27,11 +27,11 @@ enum Kompare::Format DiffParser::determineFormat()
{
qCDebug(LIBKOMPAREDIFF2) << "Determining the format of the diff Diff" << m_diffLines;
QRegExp normalRE(QStringLiteral("[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"));
QRegExp unifiedRE(QStringLiteral("^--- "));
QRegExp contextRE(QStringLiteral("^\\*\\*\\* "));
QRegExp rcsRE(QStringLiteral("^[acd][0-9]+ [0-9]+"));
QRegExp edRE(QStringLiteral("^[0-9]+[0-9,]*[acd]"));
QRegularExpression normalRE(QStringLiteral("[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"));
QRegularExpression unifiedRE(QStringLiteral("^--- "));
QRegularExpression contextRE(QStringLiteral("^\\*\\*\\* "));
QRegularExpression rcsRE(QStringLiteral("^[acd][0-9]+ [0-9]+"));
QRegularExpression edRE(QStringLiteral("^[0-9]+[0-9,]*[acd]"));
QStringList::ConstIterator it = m_diffLines.begin();
......
......@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "perforceparser.h"
#include <QRegExp>
#include <QRegularExpression>
#include <komparediffdebug.h>
#include "diffmodel.h"
......@@ -33,10 +33,10 @@ enum Kompare::Format PerforceParser::determineFormat()
{
qCDebug(LIBKOMPAREDIFF2) << "Determining the format of the Perforce Diff";
QRegExp unifiedRE(QStringLiteral("^@@"));
QRegExp contextRE(QStringLiteral("^\\*{15}"));
QRegExp normalRE(QStringLiteral("^\\d+(|,\\d+)[acd]\\d+(|,\\d+)"));
QRegExp rcsRE(QStringLiteral("^[acd]\\d+ \\d+"));
QRegularExpression unifiedRE(QStringLiteral("^@@"));
QRegularExpression contextRE(QStringLiteral("^\\*{15}"));
QRegularExpression normalRE(QStringLiteral("^\\d+(|,\\d+)[acd]\\d+(|,\\d+)"));
QRegularExpression rcsRE(QStringLiteral("^[acd]\\d+ \\d+"));
// Summary is not supported since it gives no useful parsable info
QStringList::ConstIterator it = m_diffLines.begin();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment