| 12 | |
| 13 | '''Clean-up Procedure''' |
| 14 | |
| 15 | First, svn:keywords property is removed: |
| 16 | |
| 17 | {{{ |
| 18 | find . -path '*/.svn' -prune -o -type f -print | xargs svn propdel -q svn:keywords |
| 19 | }}} |
| 20 | |
| 21 | Next, line consisting of $Id$ keyword is stripped from every plain text file using a tiny script coded in Python: |
| 22 | |
| 23 | {{{ |
| 24 | #! /usr/bin/env python |
| 25 | import fileinput |
| 26 | import re |
| 27 | import sys |
| 28 | |
| 29 | def strip_line(filename, rx): |
| 30 | sys.stderr.write(filename + '\n') |
| 31 | for line in fileinput.input(filename, inplace=1): |
| 32 | m = re.match(rx, line) |
| 33 | if m is None: |
| 34 | sys.stdout.write(line) |
| 35 | else: |
| 36 | sys.stderr.write(line) |
| 37 | |
| 38 | if len(sys.argv) < 2: |
| 39 | sys.exit("Missing filename") |
| 40 | |
| 41 | pattern = '^.*\$Id.*$' |
| 42 | rx = re.compile(pattern, re.DOTALL) |
| 43 | strip_line(sys.argv[1], rx) |
| 44 | }}} |
| 45 | |
| 46 | The script is executed for every file, excluding the working copy admin area in .svn: |
| 47 | |
| 48 | {{{ |
| 49 | for f in `find . -path '*/.svn' -prune -o -type f -print`; do ~/bin/strip_line_regex.py $f; done; |
| 50 | }}} |