comparison statparser.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
children 89f793fbedda
comparison
equal deleted inserted replaced
73:a773c6e7b301 74:10eb97683aa9
1 #include "statparser.h"
2
3 #include <QMap>
4
5 StatParser::StatParser(QString text)
6 {
7 text.replace("\r\n", "\n");
8
9 QMap<QChar, QStringList *> buckets;
10 buckets['M'] = &modified;
11 buckets['A'] = &added;
12 buckets['R'] = &removed;
13 buckets['!'] = &missing;
14 buckets['?'] = &unknown;
15
16 QStringList lines = text.split("\n", QString::SkipEmptyParts);
17 foreach (QString line, lines) {
18 if (line.length() < 3 || line[2] != ' ') continue;
19 QChar tag = line[0];
20 QString file = line.right(line.length() - 2);
21 if (buckets.contains(tag)) {
22 buckets[tag]->push_back(file);
23 }
24 }
25 }