Open initlifeinc opened 3 years ago
It's not going to be easy to know what Microsoft is doing in their app without inspecting the code. As far as diff-match-patch is concerned though it should not apply patches that are unresolvable automatically. In this case, we cannot reconcile the differences without choosing which differences we want to preserve.
It is possible to apply an invalid patch and it looks like that happened here. In the first line it looks like UserB's changes were applied first and then the patch submitted by UserA was applied over it. Line three seems to contradict this theory. Patches can specify ranges of text to keep, delete, or insert. They don't specify "change this old thing to this new thing" so if you apply them to the wrong text you will get gibberish.
Got it
I try to understand how diff-match-patch works on Microsoft TODO app.
So i try to create a case about different copies on a base text , and use diff-match-patch to resolve to get a final result, and compared it with the result got from Microsoft TODO app.
The following is my case: Here i define some names to indicate the case texts. -----------------define begin----------------------- BaseText I am the very model of a cartoon individual, My animation's comical, unusual, and whimsical, I'm quite adept at funny gags, comedic theory I have read, From wicked puns and stupid jokes to anvils that drop on your head.
TextA: I am the very model of a modern Major-General, I've information vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical, From Marathon to Waterloo, in order categorical.
TextB: I am the very model of a cartoon individual, xxxxx My animation's comical, unusual, and whimsical, I'm quite adept at funny gags, comedic theory I have read, From wicked puns and stupid jokes to anvils that drop on your head.
FinalResultText: I am the very model of a modern Major-Generxxx My aniI'veformation vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical, From Marathon to Waterloo, in order categorical.
------------------define end-----------------
The change timeline is:
I can understand that on patch demo, patch of UserB changes cannot patch on TextA, so the final result is TextA. But i cannot understand why Microsoft use DiffMatchPatch but the result is FinalResultText.
Any body known why it is?