Opened 13 years ago

Last modified 13 years ago

#480 closed task

Cleaning Subversion svn:keywords — at Version 3

Reported by: mloskot Owned by: mloskot
Priority: major Milestone:
Component: Default Version: main
Severity: Unassigned Keywords:
Cc:

Description (last modified by mloskot)

This task follows the motion of moving GEOS to GitHub.

The Subversion keywords like $Id$ should be completely cleaned. Quoting the Git FAQ:

Does git have keyword expansion?

Not recommended. Keyword expansion causes all sorts of strange
problems and isn't really useful anyway, especially
within the context of an SCM.

Clean-up Procedure

First, svn:keywords property is removed:

find . -path '*/.svn' -prune -o -type f -print  | xargs svn propdel -q svn:keywords

Next, line consisting of $Id$ keyword is stripped from every plain text file using a tiny script coded in Python:

#! /usr/bin/env python
import fileinput
import re
import sys

def strip_line(filename, rx):
    sys.stderr.write(filename + '\n')
    for line in fileinput.input(filename, inplace=1):
        m = re.match(rx, line)
        if m is None:
            sys.stdout.write(line)
        else:
            sys.stderr.write(line)

if len(sys.argv) < 2:
    sys.exit("Missing filename")

pattern = '^.*\$Id.*$'
rx = re.compile(pattern, re.DOTALL)
strip_line(sys.argv[1], rx)

The script is executed for every file, excluding the working copy admin area in .svn:

for f in `find . -path '*/.svn' -prune -o -type f -print`; do ~/bin/strip_line_regex.py $f; done;

Change History (3)

comment:1 by mloskot, 13 years ago

Description: modified (diff)
Owner: changed from geos-devel@… to mloskot
Status: newassigned

comment:2 by mloskot, 13 years ago

Removed Subversion svn:keywords property r3481

comment:3 by mloskot, 13 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.