comparison filestates.cpp @ 159:087d7cdde662

* Add InConflict state (not yet used)
author Chris Cannam
date Fri, 03 Dec 2010 12:29:57 +0000
parents 1721c580c10e
children 5c262ac73948
comparison
equal deleted inserted replaced
158:006630304b69 159:087d7cdde662
29 { 29 {
30 m_modified.clear(); 30 m_modified.clear();
31 m_added.clear(); 31 m_added.clear();
32 m_removed.clear(); 32 m_removed.clear();
33 m_missing.clear(); 33 m_missing.clear();
34 m_inConflict.clear();
34 m_unknown.clear(); 35 m_unknown.clear();
35 } 36 }
36 37
37 FileStates::State FileStates::charToState(QChar c, bool *ok) 38 FileStates::State FileStates::charToState(QChar c, bool *ok)
38 { 39 {
40 // Note that InConflict does not correspond to a stat char -- it's
41 // reported separately, by resolve --list -- stat reports files in
42 // conflict as M which means they will appear in more than one bin
43 // if we handle them naively.
44
45 //!!! -- but InConflict isn't actually handled elsewhere, it's
46 //!!! -- only a placeholder really at the moment
39 if (ok) *ok = true; 47 if (ok) *ok = true;
40 if (c == 'M') return Modified; 48 if (c == 'M') return Modified;
41 if (c == 'A') return Added; 49 if (c == 'A') return Added;
42 if (c == 'R') return Removed; 50 if (c == 'R') return Removed;
43 if (c == '!') return Missing; 51 if (c == '!') return Missing;
54 case Modified: return &m_modified; 62 case Modified: return &m_modified;
55 case Added: return &m_added; 63 case Added: return &m_added;
56 case Unknown: return &m_unknown; 64 case Unknown: return &m_unknown;
57 case Removed: return &m_removed; 65 case Removed: return &m_removed;
58 case Missing: return &m_missing; 66 case Missing: return &m_missing;
67 case InConflict: return &m_inConflict;
59 } 68 }
60 } 69 }
61 70
62 void FileStates::parseStates(QString text) 71 void FileStates::parseStates(QString text)
63 { 72 {
83 bucket->push_back(file); 92 bucket->push_back(file);
84 m_stateMap[file] = s; 93 m_stateMap[file] = s;
85 } 94 }
86 95
87 DEBUG << "FileStates: " << m_modified.size() << " modified, " << m_added.size() 96 DEBUG << "FileStates: " << m_modified.size() << " modified, " << m_added.size()
88 << " added, " << m_removed.size() << " removed, " << m_missing.size() 97 << " added, " << m_removed.size() << " removed, " << m_missing.size()
89 << " missing, " << m_unknown.size() << " unknown" << endl; 98 << " missing, " << m_inConflict.size() << " in conflict, "
99 << m_unknown.size() << " unknown" << endl;
90 } 100 }
91 101
92 QStringList FileStates::getFilesInState(State s) const 102 QStringList FileStates::getFilesInState(State s) const
93 { 103 {
94 QStringList *sl = const_cast<FileStates *>(this)->stateToBucket(s); 104 QStringList *sl = const_cast<FileStates *>(this)->stateToBucket(s);