具有文件状态的mercurial日志格式 [英] mercurial log format with file-statuses
问题描述
< p $< p>< p>修饰语>文件
< modifier> path / to / a / file
< modifier> path / to / another / file
在git中,我这样做:git show --pretty =格式:--name-status commitish并获得:
D文件
路径/ to / a /文件
M路径/到/另一个/文件
对于mercurial我无法弄清楚如何用模板做到这一点。我有一个样式文件:
pre $ change $ = {file_mods} A {file_add} \\\
file_mod =M {file_mod} \\\
file_del =D {file_del} \\\
并且使用这种风格和命令hg log -r commitish --style〜/ .hgstyle我几乎得到了我想要的:
M路径/至/另一个/文件
路径/至/一个文件
D文件
mercurial仍然存在一个问题 - 文件未按良好顺序排序。
如何获得与git命令(使用修饰符并正确排序)相同的结果在mercurial上?
有没有直接的方式使用模板引擎,但你可以尝试:
$ b
hg log - -style〜/ .hgstyle -r< rev> | sort -k2
这将对第二列数据(即文件名)上的log命令的输出进行排序。
I was wondering, how do I return files added/modified/deleted for a commit in such a format:
<modifier> file
<modifier> path/to/a/file
<modifier> path/to/another/file
In git I do this: "git show --pretty="format:" --name-status commitish" and get:
D file
A path/to/a/file
M path/to/another/file
For mercurial I can't figure out how to do it with templates. I have a style file:
changeset = "{file_mods}{file_adds}{file_dels}"
file_add = "A {file_add}\n"
file_mod = "M {file_mod}\n"
file_del = "D {file_del}\n"
and with this style and command "hg log -r commitish --style ~/.hgstyle" I get almost what I want:
M path/to/another/file
A path/to/a/file
D file
There is still one issue with mercurial - files are not sorted in good order.
How do I get the same result as on git command (with modifiers and sorted correctly) on mercurial?
There is no direct way using the templating engine, but you could try:
hg log --style ~/.hgstyle -r <rev> | sort -k2
This will sort the output of the log command on the second column of data (i.e. the file names).
这篇关于具有文件状态的mercurial日志格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!