Adapt to Fossil client version 2.12

Fossil 2.12 changes the output of 'info' command replacing the label
that attributes the check-out's hash-id from 'uuid' to 'hash' [1].

[1]: https://fossil-scm.org/fossil/info/8ad5e4690854a81 "src/info.c"

Change-Id: I1277d784c377ee37434abc017db748d16353b31e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Artur Shepilko
2020-06-17 11:22:31 -05:00
parent 30b04ca919
commit 3d7697667d
2 changed files with 11 additions and 5 deletions

View File

@@ -392,9 +392,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect
const QRegularExpression idRx("([0-9a-f]{5,40})"); const QRegularExpression idRx("([0-9a-f]{5,40})");
QTC_ASSERT(idRx.isValid(), return RevisionInfo()); QTC_ASSERT(idRx.isValid(), return RevisionInfo());
const QString hashToken =
(supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: ");
for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { for (const QString &l : output.split('\n', QString::SkipEmptyParts)) {
if (l.startsWith("checkout: ", Qt::CaseInsensitive) if (l.startsWith("checkout: ", Qt::CaseInsensitive)
|| l.startsWith("uuid: ", Qt::CaseInsensitive)) { || l.startsWith(hashToken, Qt::CaseInsensitive)) {
const QRegularExpressionMatch idMatch = idRx.match(l); const QRegularExpressionMatch idMatch = idRx.match(l);
QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo());
revisionId = idMatch.captured(1); revisionId = idMatch.captured(1);
@@ -407,8 +410,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect
const QRegularExpressionMatch idMatch = idRx.match(l); const QRegularExpressionMatch idMatch = idRx.match(l);
if (idMatch.hasMatch()) if (idMatch.hasMatch())
mergeParentIds.append(idMatch.captured(1)); mergeParentIds.append(idMatch.captured(1));
} else if (getCommentMsg } else if (getCommentMsg && l.startsWith("comment: ", Qt::CaseInsensitive)) {
&& l.startsWith("comment: ", Qt::CaseInsensitive)) {
const QStringList commentLineParts = parseRevisionCommentLine(l); const QStringList commentLineParts = parseRevisionCommentLine(l);
commentMsg = commentLineParts.value(0); commentMsg = commentLineParts.value(0);
committer = commentLineParts.value(1); committer = commentLineParts.value(1);
@@ -891,7 +893,9 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const
const unsigned int version = binaryVersion(); const unsigned int version = binaryVersion();
if (version < 0x20400) { if (version < 0x21200) {
features &= ~InfoHashFeature;
if (version < 0x20400)
features &= ~AnnotateRevisionFeature; features &= ~AnnotateRevisionFeature;
if (version < 0x13000) if (version < 0x13000)
features &= ~TimelinePathFeature; features &= ~TimelinePathFeature;

View File

@@ -49,12 +49,14 @@ public:
DiffIgnoreWhiteSpaceFeature = 0x8, DiffIgnoreWhiteSpaceFeature = 0x8,
TimelinePathFeature = 0x10, TimelinePathFeature = 0x10,
AnnotateRevisionFeature = 0x20, AnnotateRevisionFeature = 0x20,
InfoHashFeature = 0x40,
AllSupportedFeatures = // | all defined features AllSupportedFeatures = // | all defined features
AnnotateBlameFeature AnnotateBlameFeature
| TimelineWidthFeature | TimelineWidthFeature
| DiffIgnoreWhiteSpaceFeature | DiffIgnoreWhiteSpaceFeature
| TimelinePathFeature | TimelinePathFeature
| AnnotateRevisionFeature | AnnotateRevisionFeature
| InfoHashFeature
}; };
Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature) Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature)