In git, I can do "git commit --verbose" to show me a diff right there in the message editor. I don't see any option for it in mercurial. Is there a mercurial plugin to show me a diff in the message editor or anything similar?
Short answer: There is no git commit --verbose
equivalent in mercurial, but it's possible to hack it in.
The edit text is hard-coded in the mercurial source, so no plugin or configuration can directly change it.
The best you can do is to hack the ui.editor setting in your hgrc to add text into the editor directly. I made a script called hg-commit-editor:
#!/bin/sh
echo 'HG: ------------------------ >8 ------------------------' >> $1
hg diff >> $1
editor $1
exit $?
and then set it as my commit editor in my hgrc:
[ui]
editor = hg-commit-editor
This appends the output of "hg diff" to the bottom of the edit text file after a special line (source) so it's not included as part of the commit message.
Not directly but you could combine:
hg commit -l filename.txt
hg commit
?"hg commit
.hg -q outgoing --style ~/out-style.txt | sort -u
hg outgoing -v |grep files: |cut -c 14- |tr ' ' '\n' |sort -u
So: generating a file with the right information in it (list of files to be pushed) as the commit message.
The easiest solution is to download this (use the raw
link on the left hand side), put it in your $PATH
, then set HGEDITOR
environment variable to this script.
When doing hg commit
, you'll see the diff in a separate window.
See also https://www.mercurial-scm.org/wiki/hgeditor
@Mu Mind's script should still work, and probably preferable if you want it to behave as close as git commit --verbose
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With