1
我試圖把這個標準git的日誌--stat輸出:如何輸出整個git的日誌--stat到XML
commit 8a3f15205922e524d59524fe89c4304849dd6c8c
Author: FooManChu <[email protected]>
Date: Fri Jul 15 20:33:17 2016 -0400
Some Commit Message Body
foodir/foofile1.foo | 8 +
foodir/foofile2.foo | 47 +
foodir/foofile3.foo | 7049 +++++++++++++++++++++++
foodir/foofile4.foo | 3563 ++++++++++++
foodir/foofile5.foo | 24 +
foodir/foofile6.foo | 0
foodir/foofile7.foo | 41 +
7 files changed, 10732 insertions(+)
commit c8bd4ca8d683c20f3cf206fdeb8dbec2f185536e
Author: FooGirlChu <[email protected]>
Date: Fri Jul 15 00:11:24 2016 -0400
Initial commit
FOO | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
README.md | 1 +
2 files changed, 675 insertions(+)
到下面看到的XML文件結構。它不必像下面那樣直接映射,但仍然足夠接近,以便在需要時進行定製。
<?xml version="1.0" encoding="utf-8"?>
<stats>
<commit sha1='8a3f15205922e524d59524fe89c4304849dd6c8c'>
<author email='[email protected]'>FooManChu</author>
<date>Fri Jul 15 20:33:17 2016 -0400</date>
<body>Some Commit Message Body</body>
<diff-stat>
<filepathname insertions='8'>foodir/foofile1.foo</filepathname>
<filepathname insertions='47'>foodir/foofile2.foo</filepathname>
<filepathname insertions='7049'>foodir/foofile3.foo</filepathname>
<filepathname insertions='3563'>foodir/foofile4.foo</filepathname>
<filepathname insertions='24'>foodir/foofile5.foo</filepathname>
<filepathname insertions='0'>foodir/foofile6.foo</filepathname>
<filepathname insertions='41'>foodir/foofile7.foo</filepathname>
</diff-stat>
<summary changed='7' insertions='10732'/>
</commit>
<commit sha1='c8bd4ca8d683c20f3cf206fdeb8dbec2f185536e'>
<author email='[email protected]'>FooGirlChu</author>
<date>Fri Jul 15 00:11:24 2016 -0400</date>
<body>Initial commit</body>
<diff-stat>
<filepathname insertions='674'>FOO</filepathname>
<filepathname insertions='1'>README.md</filepathname>
</diff-stat>
<summary changed='2' insertions='675'/>
</commit>
</stats>
我已經看了Parsing Git Log Output和Understand Git Log Stat Output,但我一直無法複製的--stat格式。
因此我的問題是否可以在git中完成?或者我應該試圖編碼一個解析程序,而不是採取--stat作爲輸入並輸出我的XML文件?
您可以使用--numstat標誌而不是--stat,因此您不必計數加號和減號。 – DavidN
https://gist.github.com/textarcana/1306223聲稱輸出爲JSON格式。另請參閱http://stackoverflow.com/questions/4600445/git-log-output-to-xml-json-or-yaml – DavidN
我會嘗試使用JSON格式。至少它朝着正確的方向靠了一步。 –