aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/fossil/annotationhighlighter.cpp
blob: 53f9e7a849b21ed8fb56dcd8fe30344e57226541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) 2018 Artur Shepilko
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "annotationhighlighter.h"
#include "constants.h"

#include <utils/qtcassert.h>

namespace Fossil {
namespace Internal {

FossilAnnotationHighlighter::FossilAnnotationHighlighter(const VcsBase::Annotation &annotation)
    : VcsBase::BaseAnnotationHighlighter(annotation)
    , m_changesetIdPattern(Constants::CHANGESET_ID)
{
    QTC_CHECK(m_changesetIdPattern.isValid());
}

QString FossilAnnotationHighlighter::changeNumber(const QString &block) const
{
    QRegularExpressionMatch changesetIdMatch = m_changesetIdPattern.match(block);
    if (changesetIdMatch.hasMatch())
        return changesetIdMatch.captured(1);
    return {};
}

} // namespace Internal
} // namespace Fossil