When I run hg commit
, Mercurial generates a file for my commit message that looks like this :
HG: Enter commit message. Lines beginning with \'
I wanted to do this under windows. The idea of customising the editor setting in the ini/.hgrc file made me think of replacing the editor command with a command file.
e.g. if you set this in mercurial.ini:
[ui]
editor = c:\path\to\hgedit.cmd
then hg will call the command file and pass the name of the temp file on the command line. The temp file name can then be accessed in the command file using the %1 parameter.
hgedit.cmd could be something like:
@echo off
hg status --unknown>>%1
notepad %1
If you want to append the output of hg as comments you could do this:
@echo off
echo HG: -->>%1
echo HG: Unknown files:>>%1
for /f "tokens=*" %%a in ('hg st --unknown') do echo HG: %%a>>%1
notepad %1
(You don't have to use notepad of course.)