PHP class for parsing diffs

断了今生、忘了曾经 提交于 2019-12-24 02:44:23

问题


I am writing a PHP script that needs to interpret Diff files as created by Git. How should I proceed if I want to parse the Diff file and basically print it in a completely different format?

I have come across the Text_Diff PEAR library, but that one only creates the Diffs itself. Or rather, it only takes two different files as input. Is there a way to use that set of classes to achieve what I want (feed in a diff and get a tokenized diff as output, basically split up into the operations)?


回答1:


I will recommend you to take a look to the diff module drupal has, because the it use a Diff Engine class from a wiki that might be the solution you are looking for.

http://drupal.org/project/diff



来源:https://stackoverflow.com/questions/4061151/php-class-for-parsing-diffs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!