diff options
author | Tim Peters <tim.peters@gmail.com> | 2006-03-09 01:59:27 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2006-03-09 01:59:27 (GMT) |
commit | 84457af29e53eb7e0c12b3f4dcd6b6070048c17f (patch) | |
tree | 6db4e476296d65abe3662c57da340fa33d1fd2d0 /Tools/scripts/svneol.py | |
parent | d87f81f5f3792b1724c060c5d4476719abac648c (diff) | |
download | cpython-84457af29e53eb7e0c12b3f4dcd6b6070048c17f.zip cpython-84457af29e53eb7e0c12b3f4dcd6b6070048c17f.tar.gz cpython-84457af29e53eb7e0c12b3f4dcd6b6070048c17f.tar.bz2 |
Taught svneol to look at .c and .h files too, and
it found a bunch more in need of svn:eol-style.
Diffstat (limited to 'Tools/scripts/svneol.py')
-rw-r--r-- | Tools/scripts/svneol.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Tools/scripts/svneol.py b/Tools/scripts/svneol.py index 68814e4..9bab175 100644 --- a/Tools/scripts/svneol.py +++ b/Tools/scripts/svneol.py @@ -3,8 +3,8 @@ """ SVN helper script. -Try to set the svn:eol-style property to "native" on every .py and .txt file -in the directory tree rooted at the current directory. +Try to set the svn:eol-style property to "native" on every .py, .txt, .c and +.h file in the directory tree rooted at the current directory. Files with the svn:eol-style property already set (to anything) are skipped. @@ -30,16 +30,19 @@ and for a file with a binary mime-type property: svn: File 'Lib\test\test_pep263.py' has binary mime type property TODO: This is slow, and especially on Windows, because it invokes a new svn -command-line operation for every .py and .txt file. +command-line operation for every file with the right extension. """ +import re import os +possible_text_file = re.compile(r"\.([hc]|py|txt)$").search + for root, dirs, files in os.walk('.'): if '.svn' in dirs: dirs.remove('.svn') for fn in files: - if fn.endswith('.py') or fn.endswith('.txt'): + if possible_text_file(fn): path = os.path.join(root, fn) p = os.popen('svn proplist "%s"' % path) guts = p.read() |