【发布时间】:2016-06-06 18:34:41
【问题描述】:
我在 python 脚本中使用这个命令来生成一个 xml 文件,稍后由我们的 CI 系统处理:
git log -1 --date=iso --pretty=format:"<logentry revision=\"%h\" scm=\"git\">%n<author>%an</author>%n<date>%ad</date>%n<msg>%s</msg>%n"
它产生以下格式的输出
<logentry revision="1e370f5" scm="git">
<author>Johan Govers</author>
<date>2016-02-24 13:11:15 +0100</date>
<msg>PP-204 Try out git PP-207 New build script * Add missing kind="file" to path nodes in changes xml file.</msg>
使用git log -1 会显示带有换行符的消息,但使用漂亮的格式会省略它们。有没有办法产生如下输出?
<logentry revision="1e370f5" scm="git">
<author>Johan Govers</author>
<date>2016-02-24 13:11:15 +0100</date>
<msg>PP-204 Try out git
PP-207 New build script
* Add missing kind="file" to path nodes in changes xml file.</msg>
【问题讨论】: