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