hgkw/keyword.py
branch0.9.2compat
changeset 640 7e80fc29ba27
parent 639 d41074cb161b
child 648 3a0f284c872b
equal deleted inserted replaced
639:d41074cb161b 640:7e80fc29ba27
    34 #
    34 #
    35 # Run "hg help keyword" and "hg kwdemo" to get info on configuration.
    35 # Run "hg help keyword" and "hg kwdemo" to get info on configuration.
    36 
    36 
    37 '''expand keywords in tracked files
    37 '''expand keywords in tracked files
    38 
    38 
    39 This extension expands RCS/CVS-like or self-customized $Keywords$ in tracked
    39 This extension expands RCS/CVS-like or self-customized $Keywords$ in
    40 text files selected by your configuration.
    40 tracked text files selected by your configuration.
    41 
    41 
    42 Keywords are only expanded in local repositories and not stored in the change
    42 Keywords are only expanded in local repositories and not stored in the
    43 history. The mechanism can be regarded as a convenience for the current user
    43 change history. The mechanism can be regarded as a convenience for the
    44 or for archive distribution.
    44 current user or for archive distribution.
    45 
    45 
    46 Configuration is done in the [keyword] and [keywordmaps] sections of hgrc
    46 Configuration is done in the [keyword] and [keywordmaps] sections of
    47 files.
    47 hgrc files.
    48 
    48 
    49 Example:
    49 Example:
    50 
    50 
    51     [keyword]
    51     [keyword]
    52     # expand keywords in every python file except those matching "x*"
    52     # expand keywords in every python file except those matching "x*"
    53     **.py =
    53     **.py =
    54     x*    = ignore
    54     x*    = ignore
    55 
    55 
    56 NOTE: the more specific you are in your filename patterns the less you lose
    56 NOTE: the more specific you are in your filename patterns the less you
    57 speed in huge repositories.
    57 lose speed in huge repositories.
    58 
    58 
    59 For [keywordmaps] template mapping and expansion demonstration and control run
    59 For [keywordmaps] template mapping and expansion demonstration and
    60 "hg kwdemo".
    60 control run "hg kwdemo".
    61 
    61 
    62 An additional date template filter {date|utcdate} is provided.
    62 An additional date template filter {date|utcdate} is provided. It
    63 
    63 returns a date like "2006/09/18 15:13:13".
    64 The default template mappings (view with "hg kwdemo -d") can be replaced with
    64 
    65 customized keywords and templates. Again, run "hg kwdemo" to control the
    65 The default template mappings (view with "hg kwdemo -d") can be
    66 results of your config changes.
    66 replaced with customized keywords and templates. Again, run "hg
    67 
    67 kwdemo" to control the results of your config changes.
    68 Before changing/disabling active keywords, run "hg kwshrink" to avoid the risk
    68 
    69 of inadvertently storing expanded keywords in the change history.
    69 Before changing/disabling active keywords, run "hg kwshrink" to avoid
    70 
    70 the risk of inadvertently storing expanded keywords in the change
    71 To force expansion after enabling it, or a configuration change, run "hg
    71 history.
    72 kwexpand".
    72 
    73 
    73 To force expansion after enabling it, or a configuration change, run
    74 Also, when committing with the record extension or using mq's qrecord, be
    74 "hg kwexpand".
    75 aware that keywords cannot be updated. Again, run "hg kwexpand" on the files
    75 
    76 in question to update keyword expansions after all changes have been checked
    76 Also, when committing with the record extension or using mq's qrecord,
    77 in.
    77 be aware that keywords cannot be updated. Again, run "hg kwexpand" on
    78 
    78 the files in question to update keyword expansions after all changes
    79 Expansions spanning more than one line and incremental expansions, like CVS'
    79 have been checked in.
    80 $Log$, are not supported. A keyword template map "Log = {desc}" expands to the
    80 
    81 first line of the changeset description.
    81 Expansions spanning more than one line and incremental expansions,
       
    82 like CVS' $Log$, are not supported. A keyword template map "Log =
       
    83 {desc}" expands to the first line of the changeset description.
    82 
    84 
    83 Caveat: With Mercurial versions prior to 4574925db5c0 "hg import" might
    85 Caveat: With Mercurial versions prior to 4574925db5c0 "hg import" might
    84         cause rejects if the patch context contains an active keyword. In that
    86         cause rejects if the patch context contains an active keyword. In that
    85         case run "hg kwshrink", and then reimport. Or, better, use
    87         case run "hg kwshrink", and then reimport. Or, better, use
    86         bundle/unbundle to share changes.
    88         bundle/unbundle to share changes.