Re: Diff at end of commit message

2018-02-22 Thread Uwe Brauer
>>> "Stefan" == Stefan Schwarzer  writes:

> 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.

Thanks, I just tried that out, and indeed your template shows up in my
editor (gnuclient) which I use for those purpose.

But then how to you display your message, sorry for this elementary
question but I played a bit around and it is not really display. I must
miss here something obvious.

___
Mercurial mailing list
Mercurial@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial


Re: Diff at end of commit message

2018-02-20 Thread Yuya Nishihara
On Sat, 17 Feb 2018 18:42:59 +0100, Stefan Schwarzer wrote:
> 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?

Appears that there's no one-off flag to include the default commit text.

> - 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?

diff("set:not binary()") can be used to exclude binary files. See
"hg help fileset" for details.
___
Mercurial mailing list
Mercurial@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial


Diff at end of commit message

2018-02-19 Thread Stefan Schwarzer
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
___
Mercurial mailing list
Mercurial@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial