tests/test-keyword.out
branchkwmap-templates
changeset 148 c0baa881d90a
parent 131 23a1e1bdf62b
child 151 5f3856a6ce56
equal deleted inserted replaced
147:11a031a33ea2 148:c0baa881d90a
     9 for the current user and may be turned off anytime.
     9 for the current user and may be turned off anytime.
    10 
    10 
    11 Substitution takes place on every commit and update of the working
    11 Substitution takes place on every commit and update of the working
    12 repository.
    12 repository.
    13 
    13 
       
    14 Caveat: "hg import" might fail if the patches were exported from a
       
    15 repo with a different/no keyword setup, whereas "hg unbundle" is
       
    16 safe.
       
    17 
    14 Configuration is done in the [keyword] and [keywordmaps] sections of
    18 Configuration is done in the [keyword] and [keywordmaps] sections of
    15 hgrc files.
    19 hgrc files.
    16 
    20 
       
    21 Example:
       
    22      [keyword]
       
    23      # filename patterns for expansion are configured in this section
       
    24      # files matching patterns with value 'ignore' are ignored
       
    25      **.py =          ## expand keywords in all python files
       
    26      x* = ignore      ## but ignore files matching "x*"
       
    27      ...
       
    28      [keywordmaps]
       
    29      # custom hg template maps _replace_ the CVS-like default ones
       
    30      HGdate = {date|rfc822date}
       
    31      lastlog = {desc} ## same as {desc|firstline} in this context
       
    32      checked in by = {author}
       
    33      ...
       
    34 
       
    35 If no [keywordmaps] are configured the extension falls back on the
       
    36 following defaults:
       
    37 
       
    38      Revision: changeset id
       
    39      Author: username
       
    40      Date: %Y/%m/%d %H:%M:%S      ## [UTC]
       
    41      RCSFile: basename,v
       
    42      Source: /path/to/basename,v
       
    43      Id: basename,v csetid %Y/%m/%d %H:%M:%S username
       
    44      Header: /path/to/basename,v csetid %Y/%m/%d %H:%M:%S username
       
    45 
    17 no commands defined
    46 no commands defined
    18 % cat
    47 % cat
    19 $Id$
    48 expand $Id$
    20 $Id$
    49 expand $Id$
       
    50 ignore $Id$
    21 % default keyword expansion
    51 % default keyword expansion
    22 % commit
    52 % commit
    23 adding a
    53 adding a
    24 adding b
    54 adding b
       
    55 adding sym
    25 a
    56 a
    26 b
    57 b
       
    58 sym
    27 overwriting a expanding keywords
    59 overwriting a expanding keywords
    28 % status
    60 % status
    29 % cat
    61 % cat
    30 $Id: a,v b803250b3164 1970/01/01 00:00:00 user $
    62 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
    31 $Id$
    63 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
       
    64 ignore $Id$
    32 % hg cat
    65 % hg cat
    33 $Id: a,v b803250b3164 1970/01/01 00:00:00 user $
    66 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
    34 $Id$
    67 ignore $Id$
       
    68 a
    35 % update
    69 % update
    36 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
    70 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
    37 % cat
    71 % cat
    38 $Id: a,v b803250b3164 1970/01/01 00:00:00 user $
    72 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
    39 $Id$
    73 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
       
    74 ignore $Id$
    40 % custom keyword expansion
    75 % custom keyword expansion
    41 % cat
    76 % cat
    42 $Id: a,v b803250b3164 1970/01/01 00:00:00 user $
    77 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
    43 $Id$
    78 expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
       
    79 ignore $Id$
    44 % hg cat
    80 % hg cat
    45 $Id: a b803250b3164 Thu, 01 Jan 1970 00:00:00 +0000 user $
    81 expand $Id: a 126ec311add6 Thu, 01 Jan 1970 00:00:00 +0000 user $
    46 $Id$
    82 ignore $Id$
       
    83 a
    47 % commit
    84 % commit
    48 a
    85 a
    49 overwriting a expanding keywords
    86 overwriting a expanding keywords
    50 % status
    87 % status
    51 % cat
    88 % cat
    52 $Id: a 375046bad9d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
    89 expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
    53 $Xinfo: User Name <user@example.com>: firstline $
    90 $Xinfo: User Name <user@example.com>: firstline $
    54 $Id$
    91 expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
       
    92 $Xinfo: User Name <user@example.com>: firstline $
       
    93 ignore $Id$
    55 % hg cat
    94 % hg cat
    56 $Id: a 375046bad9d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
    95 expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
    57 $Xinfo: User Name <user@example.com>: firstline $
    96 $Xinfo: User Name <user@example.com>: firstline $
    58 $Id$
    97 ignore $Id$
       
    98 a
       
    99 requesting all changes
       
   100 adding changesets
       
   101 adding manifests
       
   102 adding file changes
       
   103 added 1 changesets with 3 changes to 3 files
       
   104 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   105 % incoming
       
   106 searching for changes
       
   107 changeset:   1:6022c13396d3
       
   108 tag:         tip
       
   109 user:        User Name <user@example.com>
       
   110 date:        Thu Jan 01 00:00:01 1970 +0000
       
   111 summary:     firstline
       
   112 
    59 % switch off expansion
   113 % switch off expansion
    60 % cat
   114 % cat
    61 $Id: a 375046bad9d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
   115 expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
    62 $Xinfo: User Name <user@example.com>: firstline $
   116 $Xinfo: User Name <user@example.com>: firstline $
    63 $Id$
   117 expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
       
   118 $Xinfo: User Name <user@example.com>: firstline $
       
   119 ignore $Id$
    64 % hg cat
   120 % hg cat
    65 $Id$
   121 expand $Id$
    66 $Xinfo$
   122 $Xinfo$
    67 $Id$
   123 ignore $Id$
       
   124 a
    68 % update
   125 % update
    69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   126 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
    70 % cat
   127 % cat
    71 $Id$
   128 expand $Id$
    72 $Xinfo$
   129 $Xinfo$
    73 $Id$
   130 expand $Id$
       
   131 $Xinfo$
       
   132 ignore $Id$