Mercurial > hg
comparison doc/hgrc.5.txt @ 1293:a6ffcebd3315
Enhance the file filtering capabilities.
We now allow filtering through either pipes or pairs of temporary
files. The latter appear to be mandatory for use on Windows.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 21 Sep 2005 11:44:08 -0700 |
parents | 1945754e466b |
children | a69e5a67685c |
comparison
equal
deleted
inserted
replaced
1292:141951276ba1 | 1293:a6ffcebd3315 |
---|---|
65 Filters for transforming files on checkout/checkin. This would | 65 Filters for transforming files on checkout/checkin. This would |
66 typically be used for newline processing or other | 66 typically be used for newline processing or other |
67 localization/canonicalization of files. | 67 localization/canonicalization of files. |
68 | 68 |
69 Filters consist of a filter pattern followed by a filter command. | 69 Filters consist of a filter pattern followed by a filter command. |
70 The command must accept data on stdin and return the transformed | 70 Filter patterns are globs by default, rooted at the repository |
71 data on stdout. | 71 root. For example, to match any file ending in ".txt" in the root |
72 | 72 directory only, use the pattern "*.txt". To match any file ending |
73 Example: | 73 in ".c" anywhere in the repository, use the pattern "**.c". |
74 | |
75 The filter command can start with a specifier, either "pipe:" or | |
76 "tempfile:". If no specifier is given, "pipe:" is used by default. | |
77 | |
78 A "pipe:" command must accept data on stdin and return the | |
79 transformed data on stdout. | |
80 | |
81 Pipe example: | |
74 | 82 |
75 [encode] | 83 [encode] |
76 # uncompress gzip files on checkin to improve delta compression | 84 # uncompress gzip files on checkin to improve delta compression |
77 # note: not necessarily a good idea, just an example | 85 # note: not necessarily a good idea, just an example |
78 *.gz = gunzip | 86 *.gz = pipe: gunzip |
79 | 87 |
80 [decode] | 88 [decode] |
81 # recompress gzip files when writing them to the working dir | 89 # recompress gzip files when writing them to the working dir (we |
90 # can safely omit "pipe:", because it's the default) | |
82 *.gz = gzip | 91 *.gz = gzip |
92 | |
93 A "tempfile:" command is a template. The string INFILE is replaced | |
94 with the name of a temporary file that contains the data to be | |
95 filtered by the command. The string OUTFILE is replaced with the | |
96 name of an empty temporary file, where the filtered data must be | |
97 written by the command. | |
98 | |
99 NOTE: the tempfile mechanism is recommended for Windows systems, | |
100 where the standard shell I/O redirection operators often have | |
101 strange effects. In particular, if you are doing line ending | |
102 conversion on Windows using the popular dos2unix and unix2dos | |
103 programs, you *must* use the tempfile mechanism, as using pipes will | |
104 corrupt the contents of your files. | |
105 | |
106 Tempfile example: | |
107 | |
108 [encode] | |
109 # convert files to unix line ending conventions on checkin | |
110 **.txt = tempfile: dos2unix -n INFILE OUTFILE | |
111 | |
112 [decode] | |
113 # convert files to windows line ending conventions when writing | |
114 # them to the working dir | |
115 **.txt = tempfile: unix2dos -n INFILE OUTFILE | |
83 | 116 |
84 hooks:: | 117 hooks:: |
85 Commands that get automatically executed by various actions such as | 118 Commands that get automatically executed by various actions such as |
86 starting or finishing a commit. | 119 starting or finishing a commit. |
87 changegroup;; | 120 changegroup;; |