Diff at end of commit message
Stefan Schwarzer
sschwarzer at sschwarzer.net
Sat Feb 17 17:42:59 UTC 2018
When I commit a change, I edit the commit message in the
editor. Inside the editor, I like a diff of the changes
that are about to be committed.
I found out that I can set a template for the commit
message in my Mercurial configuration file under
`[committemplate]`. At the moment, I use
[committemplate]
changeset = {desc}\n
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: {extramsg}
HG: --
HG: user: {author}\n{ifeq(p2rev, "-1", "",
"HG: branch merge\n")
}HG: branch '{branch}'\n{if(activebookmark,
"HG: bookmark '{activebookmark}'\n") }{subrepos %
"HG: subrepo {subrepo}\n" }{file_adds %
"HG: added {file}\n" }{file_mods %
"HG: changed {file}\n" }{file_dels %
"HG: removed {file}\n" }{if(files, "",
"HG: no files changed\n")}
HG: ------------------------ >8 ------------------------
HG: Do not touch the line above.
HG: Everything below will be removed.
{diff()}
which I took from the `hgrc` manpage and added the `{diff()}`
at the end.
I have two questions:
- What I'd ideally like would be the "default commit template"
for the version of Mercurial plus the `diff` call. This means
if I update to a new Mercurial version, the then-current
default commit template (possibly depending on special
situations like merges) should be used, plus the diff. Is
there a way to achieve this?
- I noticed that the above template also includes binary diffs.
Usually these aren't useful. Is there a way to let `{diff()}`
or a similar placeholder only contain text changes?
Best regards,
Stefan
More information about the Mercurial
mailing list