Reputation: 4323
Similar to how git merge two branches but:
text1
and text2
text0
- previous version of both text1 and text2diff-match-patch probably can be used to accomplish this task, but I didn't find appropriate method neither in doc nor in python package source code (because docs are not complete).
So far I come up with this:
c = "some base text with meaning"
a = "changed base text with meaning"
b = "some base text without meaning"
p1 = dmp.patch_make(c, a)
p2 = dmp.patch_make(c, b)
dmp.patch_apply(p1 + p2, c)
> ('changed base text without meaning', [True, True])
It looks like it works, but I'm not sure if this is correct method. Can someone experienced with diff-match-patch approve this?
Upvotes: 2
Views: 163