如何让 Mercurial 在“hg com”期间显示差异?
有没有办法配置 hg com
以便在外部编辑器中弹出的提交消息文件中,而不是仅显示哪些文件已更改(在 HG:
中)行)它实际上显示了完整的差异?我宁愿在文本编辑器中同时查看输出并撰写提交消息,而不是事先在命令行上单独执行 hg diff
。
Is there a way to configure hg com
so that in the commit message file that pops up in the external editor, instead of just showing which files were changed (in the HG:
lines) it actually shows the full diff? I'd rather view the output and compose my commit message simultaneously from the comfort of my text editor as opposed to doing hg diff
on the command line separately beforehand.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
截至 2016 年,可以使用
committemplate
配置选项来完成此操作。将以下内容添加到hgrc
文件中将在您键入提交消息时将差异包含在编辑器窗口中。请参阅
hg help hgrc
并搜索committemplate
了解更多信息。As of 2016, it's possible to do this with the
committemplate
configuration option. Adding the following to anhgrc
file will include the diff in the editor window inline as you type your commit message.See
hg help hgrc
and search forcommittemplate
for more information.Mercurial 没有将其作为内置功能,但很容易在编辑器中进行模拟(通过提交启动)。
以下是使用 VIM 的示例: https://www.mercurial-scm.org/wiki/DiffsInCommitMessageInVIM< /a>
hgeditor 脚本 https://www. Mercurial-scm.org/hg/hg-stable/raw-file/tip/hgeditor 提供了更多示例。
基本要点是:
hg diff
重定向到临时文件Mercurial doesn't have that as a built-in feature, but it's easy to simulate in your editor (as launched by commit).
Here's an example using VIM: https://www.mercurial-scm.org/wiki/DiffsInCommitMessageInVIM
The hgeditor script https://www.mercurial-scm.org/hg/hg-stable/raw-file/tip/hgeditor provides further examples.
The basic jist is:
hg diff
redirecting to a temp fileTortoiseHg 开箱即用:顶部面板用于提交消息,其下方是左侧面板列表受影响的文件和右窗格依次显示差异。
TortoiseHg does this out of the box: a top panel for the commit message and below that, a left pane listing the affected files and a right pane showing the diffs, one after the other.