Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SDK
libkomparediff2
Commits
b4d0a1de
Commit
b4d0a1de
authored
Oct 30, 2022
by
Volker Krause
Browse files
Port diff format detection to QRegularExpression
parent
d1d8c443
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cvsdiffparser.cpp
View file @
b4d0a1de
...
...
@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include
"cvsdiffparser.h"
#include
<QReg
Exp
>
#include
<QReg
ularExpression
>
#include
<komparediffdebug.h>
#include
"komparemodellist.h"
...
...
@@ -31,11 +31,11 @@ enum Kompare::Format CVSDiffParser::determineFormat()
{
// qCDebug(LIBKOMPAREDIFF2) << "Determining the format of the CVSDiff";
QReg
Exp
normalRE
(
QStringLiteral
(
"[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"
));
QReg
Exp
unifiedRE
(
QStringLiteral
(
"^--- [^
\\
t]+
\\
t"
));
QReg
Exp
contextRE
(
QStringLiteral
(
"^
\\
*
\\
*
\\
* [^
\\
t]+
\\
t"
));
QReg
Exp
rcsRE
(
QStringLiteral
(
"^[acd][0-9]+ [0-9]+"
));
QReg
Exp
edRE
(
QStringLiteral
(
"^[0-9]+[0-9,]*[acd]"
));
QReg
ularExpression
normalRE
(
QStringLiteral
(
"[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"
));
QReg
ularExpression
unifiedRE
(
QStringLiteral
(
"^--- [^
\\
t]+
\\
t"
));
QReg
ularExpression
contextRE
(
QStringLiteral
(
"^
\\
*
\\
*
\\
* [^
\\
t]+
\\
t"
));
QReg
ularExpression
rcsRE
(
QStringLiteral
(
"^[acd][0-9]+ [0-9]+"
));
QReg
ularExpression
edRE
(
QStringLiteral
(
"^[0-9]+[0-9,]*[acd]"
));
QStringList
::
ConstIterator
it
=
m_diffLines
.
begin
();
...
...
src/diffparser.cpp
View file @
b4d0a1de
...
...
@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include
"diffparser.h"
#include
<QReg
Exp
>
#include
<QReg
ularExpression
>
#include
<komparediffdebug.h>
...
...
@@ -27,11 +27,11 @@ enum Kompare::Format DiffParser::determineFormat()
{
qCDebug
(
LIBKOMPAREDIFF2
)
<<
"Determining the format of the diff Diff"
<<
m_diffLines
;
QReg
Exp
normalRE
(
QStringLiteral
(
"[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"
));
QReg
Exp
unifiedRE
(
QStringLiteral
(
"^--- "
));
QReg
Exp
contextRE
(
QStringLiteral
(
"^
\\
*
\\
*
\\
* "
));
QReg
Exp
rcsRE
(
QStringLiteral
(
"^[acd][0-9]+ [0-9]+"
));
QReg
Exp
edRE
(
QStringLiteral
(
"^[0-9]+[0-9,]*[acd]"
));
QReg
ularExpression
normalRE
(
QStringLiteral
(
"[0-9]+[0-9,]*[acd][0-9]+[0-9,]*"
));
QReg
ularExpression
unifiedRE
(
QStringLiteral
(
"^--- "
));
QReg
ularExpression
contextRE
(
QStringLiteral
(
"^
\\
*
\\
*
\\
* "
));
QReg
ularExpression
rcsRE
(
QStringLiteral
(
"^[acd][0-9]+ [0-9]+"
));
QReg
ularExpression
edRE
(
QStringLiteral
(
"^[0-9]+[0-9,]*[acd]"
));
QStringList
::
ConstIterator
it
=
m_diffLines
.
begin
();
...
...
src/perforceparser.cpp
View file @
b4d0a1de
...
...
@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include
"perforceparser.h"
#include
<QReg
Exp
>
#include
<QReg
ularExpression
>
#include
<komparediffdebug.h>
#include
"diffmodel.h"
...
...
@@ -33,10 +33,10 @@ enum Kompare::Format PerforceParser::determineFormat()
{
qCDebug
(
LIBKOMPAREDIFF2
)
<<
"Determining the format of the Perforce Diff"
;
QReg
Exp
unifiedRE
(
QStringLiteral
(
"^@@"
));
QReg
Exp
contextRE
(
QStringLiteral
(
"^
\\
*{15}"
));
QReg
Exp
normalRE
(
QStringLiteral
(
"^
\\
d+(|,
\\
d+)[acd]
\\
d+(|,
\\
d+)"
));
QReg
Exp
rcsRE
(
QStringLiteral
(
"^[acd]
\\
d+
\\
d+"
));
QReg
ularExpression
unifiedRE
(
QStringLiteral
(
"^@@"
));
QReg
ularExpression
contextRE
(
QStringLiteral
(
"^
\\
*{15}"
));
QReg
ularExpression
normalRE
(
QStringLiteral
(
"^
\\
d+(|,
\\
d+)[acd]
\\
d+(|,
\\
d+)"
));
QReg
ularExpression
rcsRE
(
QStringLiteral
(
"^[acd]
\\
d+
\\
d+"
));
// Summary is not supported since it gives no useful parsable info
QStringList
::
ConstIterator
it
=
m_diffLines
.
begin
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment