开发者

3-way merge in JavaScript or PHP

开发者 https://www.devze.com 2022-12-11 20:13 出处:网络
Does anyone know of an Open Source three-way merge implementation in JavaScript or PHP? I want to merge plain text files without the need to rely on any server side binaries.

Does anyone know of an Open Source three-way merge implementation in JavaScript or PHP? I want to merge plain text files without the need to rely on any server side binaries.

I found a few solutions for creating dif开发者_如何学运维fs, but no merge implementations.


Not exactly three-way merge, but Google's "Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text". And the implementation is available in Java, JavaScript, C++, C#, Lua and Python.


Synchrotron looks good. E.g. see the demo of three-way merge and conflict-handling.


Just finished my work on such a js- and php-tool. Have a look and enjoy:

https://github.com/Krassmus/Textmerger

You'd just need to write

var merged = Textmerger.get().merge(original, mytext, theirtext);

or in PHP

$merged = Textmerger::get()->merge($original, $mytext, $theirtext);

and you're done.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号