Fix TypeError when using -M command line argument
[fast-export.git] / plugins / shell_filter_file_contents / README.md
blob108cd2aca9cd0e06a52956603e3b58c7526a31f5
1 ## Shell Script File Filter
3 This plugin uses shell scripts in order to perform filtering of files.
4 If your preferred scripting is done via shell, this tool is for you.
5 Be noted, though, that this method can cause an order of magnitude slow
6 down. For small repositories, this wont be an issue.
8 To use the plugin, add
9 `--plugin shell_filter_file_contents=path/to/shell/script.sh`.
10 The filter script is supplied to the plugin option after the plugin name,
11 which is in turned passed to the plugin initialization. hg-fast-export
12 runs the filter for each exported file, pipes its content to the filter's
13 standard input, and uses the filter's standard output in place
14 of the file's original content. An example use of this feature
15 is to convert line endings in text files from CRLF to git's preferred LF,
16 although this task is faster performed using the native plugin.
18 The script is called with the following syntax:
19 `FILTER_CONTENTS <file-path> <hg-hash> <is-binary>`
21 ```
22 -- Start of crlf-filter.sh --
23 #!/bin/sh
24 # $1 = pathname of exported file relative to the root of the repo
25 # $2 = Mercurial's hash of the file
26 # $3 = "1" if Mercurial reports the file as binary, otherwise "0"
28 if [ "$3" == "1" ]; then cat; else dos2unix; fi
29 -- End of crlf-filter.sh --
30 ```