6 Try to set the svn:eol-style property to "native" on every .py, .txt, .c and
7 .h file in the directory tree rooted at the current directory.
9 Files with the svn:eol-style property already set (to anything) are skipped.
11 svn will itself refuse to set this property on a file that's not under SVN
12 control, or that has a binary mime-type property set. This script inherits
13 that behavior, and passes on whatever warning message the failing "svn
14 propset" command produces.
16 In the Python project, it's safe to invoke this script from the root of
19 No output is produced for files that are ignored. For a file that gets
20 svn:eol-style set, output looks like:
22 property 'svn:eol-style' set on 'Lib\ctypes\__init__.py'
24 For a file not under version control:
26 svn: warning: 'patch-finalizer.txt' is not under version control
28 and for a file with a binary mime-type property:
30 svn: File 'Lib\test\test_pep263.py' has binary mime type property
36 def proplist(root
, fn
):
37 "Return a list of property names for file fn in directory root"
38 path
= os
.path
.join(root
, ".svn", "props", fn
+".svn-work")
42 # no properties file: not under version control
46 # key-value pairs, of the form
53 if line
.startswith("END"):
55 assert line
.startswith("K ")
56 L
= int(line
.split()[1])
61 assert line
.startswith("V ")
62 L
= int(line
.split()[1])
68 possible_text_file
= re
.compile(r
"\.([hc]|py|txt|sln|vcproj)$").search
70 for root
, dirs
, files
in os
.walk('.'):
74 if possible_text_file(fn
):
75 if 'svn:eol-style' not in proplist(root
, fn
):
76 path
= os
.path
.join(root
, fn
)
77 os
.system('svn propset svn:eol-style native "%s"' % path
)