hgkw/keyword.py
branchkwmap-templates
changeset 147 11a031a33ea2
parent 146 df9de07ce002
child 149 0c8b7e5c25a6
equal deleted inserted replaced
146:df9de07ce002 147:11a031a33ea2
    24 # expansions or to use the CVS-like default ones.
    24 # expansions or to use the CVS-like default ones.
    25 #
    25 #
    26 # Expansions spanning more than one line are truncated to their first line.
    26 # Expansions spanning more than one line are truncated to their first line.
    27 # Incremental expansion (like CVS' $Log$) is not supported.
    27 # Incremental expansion (like CVS' $Log$) is not supported.
    28 #
    28 #
       
    29 # Binary files are not touched.
       
    30 #
    29 # Setup in hgrc:
    31 # Setup in hgrc:
    30 #
    32 #
    31 #     # enable extension
    33 #     # enable extension
    32 #     keyword = /full/path/to/keyword.py
    34 #     keyword = /full/path/to/keyword.py
    33 #     # or, if script in hgext folder:
    35 #     # or, if script in hgext folder:
    43 for the current user and may be turned off anytime.
    45 for the current user and may be turned off anytime.
    44 
    46 
    45 Substitution takes place on every commit and update of the working
    47 Substitution takes place on every commit and update of the working
    46 repository.
    48 repository.
    47 
    49 
       
    50 Caveat: "hg import" might fail if the patches were exported from a
       
    51 repo with a different/no keyword setup, whereas "hg unbundle" is
       
    52 safe.
       
    53 
    48 Configuration is done in the [keyword] and [keywordmaps] sections of
    54 Configuration is done in the [keyword] and [keywordmaps] sections of
    49 hgrc files.
    55 hgrc files.
    50 
    56 
    51 Example:
    57 Example:
       
    58      [keyword]
    52      # filename patterns for expansion are configured in this section
    59      # filename patterns for expansion are configured in this section
    53      # files matching patterns with value 'ignore' are ignored
    60      # files matching patterns with value 'ignore' are ignored
    54      [keyword]
    61      **.py =          ## expand keywords in all python files
    55      **.py =
    62      x* = ignore      ## but ignore files matching "x*"
    56      x* = ignore
       
    57      ...
    63      ...
    58      # in case you prefer your own keyword maps over the cvs-like defaults:
       
    59      [keywordmaps]
    64      [keywordmaps]
       
    65      # custom hg template maps _replace_ the CVS-like default ones
    60      HGdate = {date|rfc822date}
    66      HGdate = {date|rfc822date}
    61      lastlog = {desc} ## same as {desc|firstline} in this context
    67      lastlog = {desc} ## same as {desc|firstline} in this context
    62      checked in by = {author}
    68      checked in by = {author}
    63      ...
    69      ...
    64 
    70 
    65 If you do not have any [keywordmaps] configured the extension falls back on
    71 If no [keywordmaps] are configured the extension falls back on the
    66 the following defaults:
    72 following defaults:
    67 
    73 
    68      Revision: changeset id
    74      Revision: changeset id
    69      Author: username
    75      Author: username
    70      Date: %Y/%m/%d %H:%M:%S [UTC]
    76      Date: %Y/%m/%d %H:%M:%S      ## [UTC]
    71      RCSFile: basename,v
    77      RCSFile: basename,v
    72      Source: /path/to/basename,v
    78      Source: /path/to/basename,v
    73      Id: basename,v csetid %Y/%m/%d %H:%M:%S username
    79      Id: basename,v csetid %Y/%m/%d %H:%M:%S username
    74      Header: /path/to/basename,v csetid %Y/%m/%d %H:%M:%S username
    80      Header: /path/to/basename,v csetid %Y/%m/%d %H:%M:%S username
    75 '''
    81 '''