开发者

Generate a collection of changed lines between two revisions of a file using Java

I am writing an eclipse plugin which needs to be able to determine which lines of a file have changed compared to a different version of the same file.

Is there an existing class or library which I can use for this task?

The closest I have found is org.eclipse.compare.internal.merge.DocumentMerger. This can be used to find the information I need but is in an internal package so is not suitable for me t开发者_JAVA百科o use. I could copy/paste the source of this class and adapt it to my requirements. However, I am hoping there is an existing library to handle textual comparisons.


For textual comparisons, try the google-diff-match-patch library. (I don't know whether Eclipse already has something similar built-in.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜