make `view diff on commit` a feature that is easy to use

anatoly techtonik techtonik at gmail.com
Tue Nov 4 20:50:38 UTC 2014


I always do `hg diff` before `hg ci` (sometimes also `hg sum/st`),
which is very clumsy, so I went to see if something is already
available.

vim-only
https://stackoverflow.com/questions/8009333/vim-show-diff-on-commit-in-mercurial
http://mercurial.selenic.com/wiki/DiffsInCommitMessageInVIM

bash-only
http://mercurial.selenic.com/wiki/hgeditor


I've tried to bring my own solution with temporary file, but the
diff with prepended HG: loses syntax highlighting. So, to make
this feature more useful, maybe these two things are possible
to implement:

1. remove all lines after HG: block, i.e.
-HG: Enter commit message.  Lines beginning with 'HG:' are removed.
-HG: Leave message empty to abort commit.
+HG: Enter commit message.  Lines beginning with 'HG:' and any text
+HG: after are removed. Leave message empty to abort commit.

2. hg commit -v  to show diff
    hg commit -vv to show diff + diffstat
(grabbed the idea from SO comment above)

This way the editor can use the full diff highlight and you can copy
paste things from it also.


This looks like a killer feature to me. Is it why hgeditor is located in
the root of Mercurial repository and not in contrib/ ?
-- 
anatoly t.



More information about the Mercurial mailing list