| 180 | } |
| 181 | |
| 182 | bool MergeFileInfos::compareFilesAndCalcAges(QStringList& errors, DirectoryMergeWindow* pDMW) |
| 183 | { |
| 184 | enum class FileIndex |
| 185 | { |
| 186 | a, |
| 187 | b, |
| 188 | c |
| 189 | }; |
| 190 | |
| 191 | std::map<QDateTime, FileIndex> dateMap; |
| 192 | |
| 193 | if(existsInA()) |
| 194 | { |
| 195 | dateMap[getFileInfoA()->lastModified()] = FileIndex::a; |
| 196 | } |
| 197 | if(existsInB()) |
| 198 | { |
| 199 | dateMap[getFileInfoB()->lastModified()] = FileIndex::b; |
| 200 | } |
| 201 | if(existsInC()) |
| 202 | { |
| 203 | dateMap[getFileInfoC()->lastModified()] = FileIndex::c; |
| 204 | } |
| 205 | |
| 206 | if(gOptions->m_bDmFullAnalysis) |
| 207 | { |
| 208 | if((existsInA() && isDirA()) || (existsInB() && isDirB()) || (existsInC() && isDirC())) |
| 209 | { |
| 210 | // If any input is a directory, don't start any comparison. |
| 211 | m_bEqualAB = existsInA() && existsInB(); |
| 212 | m_bEqualAC = existsInA() && existsInC(); |
| 213 | m_bEqualBC = existsInB() && existsInC(); |
| 214 | } |
| 215 | else |
| 216 | { |
| 217 | Q_EMIT pDMW->startDiffMerge(errors, |
| 218 | existsInA() ? getFileInfoA()->absoluteFilePath() : QString(""), |
| 219 | existsInB() ? getFileInfoB()->absoluteFilePath() : QString(""), |
| 220 | existsInC() ? getFileInfoC()->absoluteFilePath() : QString(""), |
| 221 | "", |
| 222 | "", "", "", &diffStatus()); |
| 223 | qint32 nofNonwhiteConflicts = diffStatus().getNonWhitespaceConflicts(); |
| 224 | |
| 225 | if(gOptions->m_bDmWhiteSpaceEqual && nofNonwhiteConflicts == 0) |
| 226 | { |
| 227 | m_bEqualAB = existsInA() && existsInB(); |
| 228 | m_bEqualAC = existsInA() && existsInC(); |
| 229 | m_bEqualBC = existsInB() && existsInC(); |
| 230 | } |
| 231 | else |
| 232 | { |
| 233 | m_bEqualAB = diffStatus().isBinaryEqualAB(); |
| 234 | m_bEqualBC = diffStatus().isBinaryEqualBC(); |
| 235 | m_bEqualAC = diffStatus().isBinaryEqualAC(); |
| 236 | } |
| 237 | |
| 238 | //Limit size of error list in memory. |
| 239 | if(errors.size() >= 30) |
no test coverage detected