make `view diff on commit` a feature that is easy to use
anatoly techtonik
techtonik at gmail.com
Fri Nov 14 08:25:09 UTC 2014
On Fri, Nov 14, 2014 at 4:12 AM, Katsunori Fujiwara
<flying.foozy at gmail.com> wrote:
> 2014-11-05 5:50 GMT+09:00 anatoly techtonik <techtonik at gmail.com>:
>
>> 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)
>
> Would customization by "[committemplate]" configuration help you ?
>
> http://www.selenic.com/mercurial/hgrc.5.html#committemplate
>
> Combination of "[committemplate]" and the template
> function "diff()" allows you to show "diff" of the newly added
> revision in your favorite style.
My favorite style is to show diffs without HG: prefix on each line, which is
impossible with committemplate too.
--
anatoly t.
More information about the Mercurial
mailing list