如何自定义由hg commit生成的"commit message file"? [英] How do I customize the 'commit message file' generated by `hg commit`?
问题描述
当我运行hg commit
时,Mercurial会为我的提交消息生成一个文件,如下所示:
When I run hg commit
, Mercurial generates a file for my commit message that looks like this :
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: Henri Wiechers <hwiechers@gmail.com>
HG: branch 'default'
HG: added a.txt
是否可以自定义此文件?我想附上工作副本是否包含 任何未知文件.
Is there a way to customize this file? I'd like to include if the working copy has any unknown files.
推荐答案
目前尚无官方方法可以修改水银本身(不是很吓人,这是非常干净的Python),但这是通过调整来做到这一点的方法. editor
设置~/.hgrc
的[ui]
部分:
There's no official way to do it w/o modifying mercurial itself (not terribly intimidating, it's very clean Python), but here's a way to do it by tweaking the editor
setting the [ui]
section of your ~/.hgrc
:
editor = hg status --unknown >! /tmp/unknown_list ; /usr/bin/vim -c "r /tmp/unknown_list"
当然,这是特定于Linux的vim,但是对于任何OS上的任何体面的编辑器都可以进行同样的操作.
That is, of course vim on Linux specific, but the same could be done for any decent editor on any OS.
这篇关于如何自定义由hg commit生成的"commit message file"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!