summaryrefslogtreecommitdiff
path: root/src/plugins/bazaar/annotationhighlighter.cpp
blob: 8f99f9ec06a1d77172c8711e9abb798020cf5bdb (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
// Copyright (C) 2016 Hugues Delorme
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

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

#include <QRegularExpression>

namespace Bazaar::Internal {

BazaarAnnotationHighlighter::BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers,
                                                         QTextDocument *document)
    : VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
      m_changeset(QLatin1String(Constants::ANNOTATE_CHANGESET_ID))
{ }

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

} // Bazaar::Internal