From 2ddd1758e673d8d5eba2a298eb1c5ad2760b481b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 24 Dec 2007 21:30:30 -0200 Subject: [PATCH] Beautify the rule debug output --- src/ruleparser.cpp | 9 +++++++++ src/ruleparser.h | 5 +++++ src/svn.cpp | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ruleparser.cpp b/src/ruleparser.cpp index b17bb96..c90d103 100644 --- a/src/ruleparser.cpp +++ b/src/ruleparser.cpp @@ -139,3 +139,12 @@ void Rules::load() } } } + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug s, const Rules::Match &rule) +{ + s.nospace() << rule.rx.pattern() << " (line " << rule.lineNumber << ")"; + return s.maybeSpace(); +} + +#endif diff --git a/src/ruleparser.h b/src/ruleparser.h index 7f458e7..9525f14 100644 --- a/src/ruleparser.h +++ b/src/ruleparser.h @@ -71,4 +71,9 @@ private: QList m_matchRules; }; +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +QDebug operator<<(QDebug, const Rules::Match &); +#endif + #endif diff --git a/src/svn.cpp b/src/svn.cpp index 84ed9a4..615f9e1 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -477,7 +477,7 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change case Rules::Match::Ignore: // ignore rule qDebug() << " " << qPrintable(current) << "rev" << revnum - << "-> ignored (rule line" << rule.lineNumber << ")"; + << "-> ignored (rule" << rule << ")"; return EXIT_SUCCESS; case Rules::Match::Recurse: @@ -485,7 +485,7 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change if (is_dir) return recurse(key, change, path_from, rev_from, revpool); if (change->change_kind != svn_fs_path_change_delete) - qWarning() << " recurse rule " << rule.rx.pattern() << "line" << rule.lineNumber + qWarning() << " recurse rule" << rule << "applied to non-directory:" << qPrintable(current); return EXIT_SUCCESS; @@ -556,7 +556,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha Repository *repo = repositories.value(repository, 0); if (!repo) { - qCritical() << "Rule" << rule.rx.pattern() << "line" << rule.lineNumber + qCritical() << "Rule" << rule << "references unknown repository" << repository; return EXIT_FAILURE; } @@ -570,7 +570,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha if (!txn) { Repository *repo = repositories.value(repository, 0); if (!repo) { - qCritical() << "Rule" << rule.rx.pattern() << "line" << rule.lineNumber + qCritical() << "Rule" << rule << "references unknown repository" << repository; return EXIT_FAILURE; } -- 2.45.0