rtfpessoa / diff2html

Pretty diff to html javascript library (diff2html)
https://diff2html.xyz
MIT License
2.88k stars 278 forks source link

can not parse diff created by svnlook #122

Closed chenliangyu closed 7 years ago

chenliangyu commented 7 years ago

command: svnlook diff -r REVISION REPOS_PATH diff output: Deleted: 44.txt

--- 44.txt 2016-12-09 11:23:56 UTC (rev 10) +++ 44.txt 2017-02-07 07:48:54 UTC (rev 11) @@ -1,2 +0,0 @@ -dddd -ddd

Modified: 4444.txt

--- 4444.txt 2016-12-09 11:23:56 UTC (rev 10) +++ 4444.txt 2017-02-07 07:48:54 UTC (rev 11) @@ -0,0 +1,4 @@ +ddd +dS都没打开吗dklndsd时代大厦 +都说了考试都能看 +

Added: 6.txt

Deleted: 7.txt

problems:

  1. filename is not correct. it's 4444.txt 2017-02-07 07:48:54 UTC 2.when add/delete a empty file, it can not transform to json.
rtfpessoa commented 7 years ago

@chenliangyu that diff is not following the Unified Diff Spec

At first glance it seems that it has the timezone format wrong and adds information about the revision in the end.

Seems possible to change the parser so it supports that format.

PRs are welcome. If you want a head start, take a look into https://github.com/rtfpessoa/diff2html/blob/master/src/diff-parser.js#L409. This method is the one parsing those lines.

rtfpessoa commented 7 years ago

Closing for inactivity.