Patchwork [2,of,2,V2] config: add docs for ignoring all text below in the editor

login
register
mail settings
Submitter Sean Farley
Date Jan. 5, 2017, 7:45 a.m.
Message ID <db9f05a54af42bfb8d6c.1483602308@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/18099/
State Accepted
Headers show

Comments

Sean Farley - Jan. 5, 2017, 7:45 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1483590762 21600
#      Wed Jan 04 22:32:42 2017 -0600
# Node ID db9f05a54af42bfb8d6c194b2a7d2e304c6faae6
# Parent  0ca4ce1550141b0372c916b9964c510788685e54
config: add docs for ignoring all text below in the editor

This is an example of how to use the new string "HG:
------------------------ >8 ------------------------" for ignoring
the diff in a commit message.
Pierre-Yves David - Jan. 6, 2017, 12:17 a.m.
On 01/05/2017 08:45 AM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean@farley.io>
> # Date 1483590762 21600
> #      Wed Jan 04 22:32:42 2017 -0600
> # Node ID db9f05a54af42bfb8d6c194b2a7d2e304c6faae6
> # Parent  0ca4ce1550141b0372c916b9964c510788685e54
> config: add docs for ignoring all text below in the editor
>
> This is an example of how to use the new string "HG:
> ------------------------ >8 ------------------------" for ignoring
> the diff in a commit message.

That one is pushed with a minor changes to the doc to have the 
marker-line on its own line. I ran the change through Sean via IRC.

Many thanks.

   nb_unfixed_recurrent_topic -= 1
   marmoute.bonus_point["smf"] += 1

Cheers,

Patch

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -416,10 +416,30 @@  one shown by default::
        "HG: added {file}\n"                   }{file_mods %
        "HG: changed {file}\n"                 }{file_dels %
        "HG: removed {file}\n"                 }{if(files, "",
        "HG: no files changed\n")}
 
+``diff()``
+    String: show the diff (see :hg:`help templates` for detail)
+
+Sometimes it is helpful to show the diff of the changeset in the editor without
+having to prefix 'HG: ' to each line so that highlighting works correctly. For
+this, Mercurial provides the special string ``HG: ------------------------ >8
+------------------------`` which will ignore everything below it.
+
+For example, the template configuration below will show the diff below the
+extra message::
+
+    [committemplate]
+    changeset = {desc}\n\n
+        HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+        HG: {extramsg}
+        HG: ------------------------ >8 ------------------------
+        HG: Do not touch the line above.
+        HG: Everything below will be removed.
+        {diff()}
+
 .. note::
 
    For some problematic encodings (see :hg:`help win32mbcs` for
    detail), this customization should be configured carefully, to
    avoid showing broken characters.