data/ICalMerge.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "ICalMerge.h" | ||
| 2 | |||
| 3 | #include "ICalMergePlan.h" | ||
| 4 | |||
| 5 | namespace ICalMerge { | ||
| 6 | |||
| 7 | // Sprint 107 S107.2.3: the automatic merge is the plan with its default | ||
| 8 | // choices; the oracles (tests/test_merge_oracles.cpp) keep it byte-identical | ||
| 9 | // to the Sprint 93 implementation. | ||
| 10 | 96 | Result merge(const QString &baseText, const QString &oursText, const QString &theirsText) { | |
| 11 | 96 | Result result; | |
| 12 |
1/1✓ Branch 2 → 3 taken 96 times.
|
96 | const Merge::Plan plan = ICalMergePlan::analyze(baseText, oursText, theirsText); |
| 13 |
2/2✓ Branch 3 → 4 taken 5 times.
✓ Branch 3 → 6 taken 91 times.
|
96 | if (!plan.comparable) { |
| 14 | 5 | result.error = plan.error; | |
| 15 | 5 | return result; | |
| 16 | } | ||
| 17 |
2/2✓ Branch 24 → 8 taken 487 times.
✓ Branch 24 → 25 taken 91 times.
|
578 | for (const Merge::Item &item : plan.items) |
| 18 |
8/11✓ Branch 9 → 10 taken 76 times.
✓ Branch 9 → 14 taken 411 times.
✓ Branch 10 → 11 taken 76 times.
✓ Branch 12 → 13 taken 76 times.
✗ Branch 12 → 14 not taken.
✓ Branch 15 → 16 taken 76 times.
✓ Branch 15 → 17 taken 411 times.
✓ Branch 17 → 18 taken 76 times.
✓ Branch 17 → 22 taken 411 times.
✗ Branch 38 → 39 not taken.
✗ Branch 38 → 40 not taken.
|
487 | if (item.state == Merge::State::Conflict && !result.conflicts.contains(ICalMergePlan::conflictName(item))) |
| 19 |
2/2✓ Branch 18 → 19 taken 76 times.
✓ Branch 19 → 20 taken 76 times.
|
76 | result.conflicts.append(ICalMergePlan::conflictName(item)); |
| 20 |
2/2✓ Branch 26 → 27 taken 59 times.
✓ Branch 26 → 28 taken 32 times.
|
91 | if (!result.conflicts.isEmpty()) |
| 21 | 59 | return result; | |
| 22 |
1/1✓ Branch 28 → 29 taken 32 times.
|
32 | const ICalMergePlan::Applied applied = ICalMergePlan::apply(plan); |
| 23 |
1/2✗ Branch 29 → 30 not taken.
✓ Branch 29 → 32 taken 32 times.
|
32 | if (!applied.ok) { |
| 24 | ✗ | result.error = applied.error; | |
| 25 | ✗ | return result; | |
| 26 | } | ||
| 27 | 32 | result.ok = true; | |
| 28 | 32 | result.merged = applied.text; | |
| 29 | 32 | return result; | |
| 30 | 96 | } | |
| 31 | |||
| 32 | } // namespace ICalMerge | ||
| 33 |