Changes between Version 1 and Version 3 of Ticket #480


Ignore:
Timestamp:
Sep 22, 2011, 6:03:58 PM (13 years ago)
Author:
mloskot
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #480 – Description

    v1 v3  
    1010within the context of an SCM.
    1111}}}
     12
     13'''Clean-up Procedure'''
     14
     15First, svn:keywords property is removed:
     16
     17{{{
     18find . -path '*/.svn' -prune -o -type f -print  | xargs svn propdel -q svn:keywords
     19}}}
     20
     21Next, 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
     25import fileinput
     26import re
     27import sys
     28
     29def 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
     38if len(sys.argv) < 2:
     39    sys.exit("Missing filename")
     40
     41pattern = '^.*\$Id.*$'
     42rx = re.compile(pattern, re.DOTALL)
     43strip_line(sys.argv[1], rx)
     44}}}
     45
     46The script is executed for every file, excluding the working copy admin area in .svn:
     47
     48{{{
     49for f in `find . -path '*/.svn' -prune -o -type f -print`; do ~/bin/strip_line_regex.py $f; done;
     50}}}