Build a new MergeBlockList from scratch using a Diff3LineList. */
| 195 | Build a new MergeBlockList from scratch using a Diff3LineList. |
| 196 | */ |
| 197 | void MergeBlockList::buildFromDiff3(const Diff3LineList &diff3List, bool isThreeway) |
| 198 | { |
| 199 | LineType lineIdx = 0; |
| 200 | for(auto it = diff3List.cbegin(); it != diff3List.cend(); ++it) |
| 201 | { |
| 202 | const Diff3Line &d = *it; |
| 203 | MergeBlock mb; |
| 204 | bool bLineRemoved; |
| 205 | |
| 206 | mb.mergeOneLine(d, bLineRemoved, !isThreeway); |
| 207 | mb.dectectWhiteSpaceConflict(d, isThreeway); |
| 208 | |
| 209 | mb.d3lLineIdx = lineIdx; |
| 210 | mb.bDelta = mb.srcSelect != e_SrcSelector::A; |
| 211 | mb.mId3l = it; |
| 212 | mb.srcRangeLength = 1; |
| 213 | |
| 214 | MergeBlock *lBack = empty() ? nullptr : &back(); |
| 215 | |
| 216 | bool bSame = lBack != nullptr && mb.isSameKind(*lBack); |
| 217 | if(bSame) |
| 218 | { |
| 219 | ++lBack->srcRangeLength; |
| 220 | if(lBack->isWhiteSpaceConflict() && !mb.isWhiteSpaceConflict()) |
| 221 | lBack->bWhiteSpaceConflict = false; |
| 222 | } |
| 223 | else |
| 224 | { |
| 225 | push_back(mb); |
| 226 | } |
| 227 | |
| 228 | if(!mb.isConflict()) |
| 229 | { |
| 230 | MergeBlock &tmpBack = back(); |
| 231 | MergeEditLine mel(mb.id3l()); |
| 232 | mel.setSource(mb.srcSelect, bLineRemoved); |
| 233 | tmpBack.list().push_back(mel); |
| 234 | } |
| 235 | else if(lBack == nullptr || !lBack->isConflict() || !bSame) |
| 236 | { |
| 237 | MergeBlock &tmpBack = back(); |
| 238 | MergeEditLine mel(mb.id3l()); |
| 239 | mel.setConflict(); |
| 240 | tmpBack.list().push_back(mel); |
| 241 | } |
| 242 | |
| 243 | ++lineIdx; |
| 244 | } |
| 245 | } |
| 246 | /* |
| 247 | Changes default merge settings currently used when not in auto mode or if white space is being auto solved. |
| 248 | */ |
no test coverage detected