2018-11-05 15:31:06 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import re
|
2019-02-10 03:24:37 +01:00
|
|
|
import git_filter_repo as fr
|
2018-11-05 15:31:06 +01:00
|
|
|
|
|
|
|
def strip_cvs_keywords(blob):
|
|
|
|
# FIXME: Should first check if blob is a text file to avoid ruining
|
|
|
|
# binaries. Could use python.magic here, or just output blob.data to
|
|
|
|
# the unix 'file' command
|
|
|
|
pattern = r'\$(Id|Date|Source|Header|CVSHeader|Author|Revision):.*\$'
|
|
|
|
replacement = r'$\1$'
|
|
|
|
blob.data = re.sub(pattern, replacement, blob.data)
|
|
|
|
|
2019-02-10 03:24:37 +01:00
|
|
|
args = fr.FilteringOptions.parse_args(['--force'])
|
|
|
|
filter = fr.RepoFilter(args, blob_callback = strip_cvs_keywords)
|
2018-11-05 15:31:06 +01:00
|
|
|
filter.run()
|