diff options
author | Artur Shepilko <artur.shepilko@nomadbyte.com> | 2020-06-17 11:22:31 -0500 |
---|---|---|
committer | Artur Shepilko <artur.shepilko@nomadbyte.com> | 2020-06-17 18:02:59 +0000 |
commit | 3d7697667d431a678ebddc96e8fc0ae78755ef2d (patch) | |
tree | 8f18d4b546aef4e82414e08cded6254ee2832035 | |
parent | 30b04ca9190f139498f59b7e75eea19933ceec4f (diff) |
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>
-rw-r--r-- | plugins/fossil/fossilclient.cpp | 14 | ||||
-rw-r--r-- | plugins/fossil/fossilclient.h | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/plugins/fossil/fossilclient.cpp b/plugins/fossil/fossilclient.cpp index a2817d0..ead861d 100644 --- a/plugins/fossil/fossilclient.cpp +++ b/plugins/fossil/fossilclient.cpp @@ -392,9 +392,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QRegularExpression idRx("([0-9a-f]{5,40})"); QTC_ASSERT(idRx.isValid(), return RevisionInfo()); + const QString hashToken = + (supportedFeatures().testFlag(InfoHashFeature) ? "hash: " : "uuid: "); + for (const QString &l : output.split('\n', QString::SkipEmptyParts)) { if (l.startsWith("checkout: ", Qt::CaseInsensitive) - || l.startsWith("uuid: ", Qt::CaseInsensitive)) { + || l.startsWith(hashToken, Qt::CaseInsensitive)) { const QRegularExpressionMatch idMatch = idRx.match(l); QTC_ASSERT(idMatch.hasMatch(), return RevisionInfo()); revisionId = idMatch.captured(1); @@ -407,8 +410,7 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const QString &workingDirect const QRegularExpressionMatch idMatch = idRx.match(l); if (idMatch.hasMatch()) mergeParentIds.append(idMatch.captured(1)); - } else if (getCommentMsg - && l.startsWith("comment: ", Qt::CaseInsensitive)) { + } else if (getCommentMsg && l.startsWith("comment: ", Qt::CaseInsensitive)) { const QStringList commentLineParts = parseRevisionCommentLine(l); commentMsg = commentLineParts.value(0); committer = commentLineParts.value(1); @@ -891,8 +893,10 @@ FossilClient::SupportedFeatures FossilClient::supportedFeatures() const const unsigned int version = binaryVersion(); - if (version < 0x20400) { - features &= ~AnnotateRevisionFeature; + if (version < 0x21200) { + features &= ~InfoHashFeature; + if (version < 0x20400) + features &= ~AnnotateRevisionFeature; if (version < 0x13000) features &= ~TimelinePathFeature; if (version < 0x12900) diff --git a/plugins/fossil/fossilclient.h b/plugins/fossil/fossilclient.h index 7c9fba0..20f3214 100644 --- a/plugins/fossil/fossilclient.h +++ b/plugins/fossil/fossilclient.h @@ -49,12 +49,14 @@ public: DiffIgnoreWhiteSpaceFeature = 0x8, TimelinePathFeature = 0x10, AnnotateRevisionFeature = 0x20, + InfoHashFeature = 0x40, AllSupportedFeatures = // | all defined features AnnotateBlameFeature | TimelineWidthFeature | DiffIgnoreWhiteSpaceFeature | TimelinePathFeature | AnnotateRevisionFeature + | InfoHashFeature }; Q_DECLARE_FLAGS(SupportedFeatures, SupportedFeature) |