diff logparser.cpp @ 74:10eb97683aa9

* Show branch names even for changes with children, if those children are on a different branch * Pick up remote repo path from local repo via hg paths * Some work towards breaking down files into various groups based on status * Add /usr/local/bin to path for hg (temporary hack I hope)
author Chris Cannam
date Fri, 19 Nov 2010 14:54:19 +0000
parents f583e44d9d31
children 8ae3b44c0073
line wrap: on
line diff
--- a/logparser.cpp	Thu Nov 18 18:08:18 2010 +0000
+++ b/logparser.cpp	Fri Nov 19 14:54:19 2010 +0000
@@ -17,10 +17,13 @@
 
 #include "logparser.h"
 
+#include "debug.h"
+
 #include <QStringList>
 #include <QRegExp>
 
-LogParser::LogParser(QString text) : m_text(text)
+LogParser::LogParser(QString text, QString separator) :
+    m_text(text), m_sep(separator)
 {
     m_text.replace("\r\n", "\n");
 }
@@ -33,7 +36,7 @@
 LogList LogParser::parse()
 {
     LogList results;
-    QRegExp re("^(\\w+):\\s+(.*)$");
+    QRegExp re(QString("^(\\w+)\\s*%1\\s+(.*)$").arg(m_sep));
     QStringList entries = split();
     foreach (QString entry, entries) {
         LogEntry dictionary;
@@ -42,7 +45,7 @@
             if (re.indexIn(line) == 0) {
                 QString key = re.cap(1);
                 QString value = re.cap(2);
-                dictionary[key] = value;
+                dictionary[key.trimmed()] = value;
             }
         }
         results.push_back(dictionary);