更改hg log -v的格式

时间:2011-05-24 20:06:53

标签: mercurial hg-log

当我们hg log -v时,我们会看到:

changeset:   2639:283fb2da345f
parent:      2638:e06cb712d37b
parent:      2631:d8f619046812
user:        joe@pub.com
date:        Wed Apr 13 12:29:57 2011 -0400
files:       core/src/main/java/com/blah/boards/InvalidRateException.java core/src/main/java/com/blah/boards/InvalidException.java core/src/main/java/com/blah/area/xxx/instructions/AssignInstruction.java core/src/main/java/com/blah/area/xxx/instructions/AutoAssignInstruction.java core/src/main/java/com/blah/area/xxx/instructions/AutoDeliveryInstruction.java 
description:
Commiting after merge

有没有办法以更易读的方式输出文件?类似的东西:

files:       
core/src/main/java/com/blah/boards/InvalidRateException.java 
core/src/main/java/com/blah/boards/InvalidException.java 
core/src/main/java/com/blah/area/xxx/instructions/AssignInstruction.java 
core/src/main/java/com/blah/area/xxx/instructions/AutoAssignInstruction.java 
core/src/main/java/com/blah/area/xxx/instructions/AutoDeliveryInstruction.java 

3 个答案:

答案 0 :(得分:2)

您可以通过--template选项指定自己的模板。见hg help templates。你可以尝试例如。

hg log --template "(...) files:\n{files|stringify|fill76}\n"

答案 1 :(得分:1)

如果您只想要单个修订的文件列表,可以使用hg status --change 2639,其中显示前缀为M,A,R,D的文件列表,您可以通过添加--no-status来省略标志。

答案 2 :(得分:0)

这个问题已经过时了,但无论如何,这里有一个解决方案:

hg log -v  --template "{files % '{file}\n'}"

值得检查:http://www.selenic.com/mercurial/hg.1.html#template-usage