• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:native +full:- +full:file

3 # Copyright (C) 2009-2012, International Business Machines Corporation, Google and Others.
8 # This script is a modified version of ICU's icu-svnprops-check.py.
9 # Also check for the correct line endings on files with svn:eol-style = native
12 # It only works correctly on platforms where the native line ending is a plain \n
15 # cldr-svnprops-check.py [options]
18 # -f | --fix Fix any problems that are found
19 # -h | --help Print a usage line and exit.
33 # Copy and paste here the ICU recommended auto-props from
34 # http://icu-project.org/docs/subversion_howto/index.html
41 [auto-props]
43 ### file-name-pattern = propname[=value][;propname[=value]...]
44 ### The file-name-pattern can contain wildcards (such as '*' and
45 ### '?'). All entries which match will be applied to the file.
46 ### Note that auto-props functionality must be enabled, which
47 ### is typically done by setting the 'enable-auto-props' option.
48 *.c = svn:eol-style=native
49 *.cc = svn:eol-style=native
50 *.cpp = svn:eol-style=native
51 *.h = svn:eol-style=native
52 *.rc = svn:eol-style=native
53 *.dsp = svn:eol-style=native
54 *.dsw = svn:eol-style=native
55 *.sln = svn:eol-style=native
56 *.vcproj = svn:eol-style=native
57 configure = svn:eol-style=native;svn:executable
58 *.sh = svn:eol-style=native;svn:executable
59 *.pl = svn:eol-style=native;svn:executable
60 *.py = svn:eol-style=native;svn:executable
61 *.txt = svn:mime-type=text/plain;svn:eol-style=native
62 *.java = svn:eol-style=native;svn:mime-type=text/plain;;charset=utf-8
63 *.ucm = svn:eol-style=native
64 *.html = svn:eol-style=native;svn:mime-type=text/html
65 *.htm = svn:eol-style=native;svn:mime-type=text/html
66 *.xml = svn:eol-style=native
67 Makefile = svn:eol-style=native
68 *.in = svn:eol-style=native
69 *.mak = svn:eol-style=native
70 *.mk = svn:eol-style=native
71 *.png = svn:mime-type=image/png
72 *.jpeg = svn:mime-type=image/jpeg
73 *.jpg = svn:mime-type=image/jpeg
74 *.bin = svn:mime-type=application/octet-stream
75 *.brk = svn:mime-type=application/octet-stream
76 *.cnv = svn:mime-type=application/octet-stream
77 *.dat = svn:mime-type=application/octet-stream
78 *.icu = svn:mime-type=application/octet-stream
79 *.res = svn:mime-type=application/octet-stream
80 *.spp = svn:mime-type=application/octet-stream
81 # new additions 2007-dec-5 srl
82 *.rtf = mime-type=text/rtf
83 *.pdf = mime-type=application/pdf
84 # changed 2008-04-08: modified .txt, above, adding mime-type
85 # changed 2010-11-09: modified .java, adding mime-type
90 # file_types: The parsed form of the svn auto-props specification.
91 # A list of file types - .cc, .cpp, .txt, etc.
93 # "type" is a regular expression string that will match a file name
103 if re.match("\s*\[auto-props\]", propline): # Match the [auto-props] line.
105 if not re.match("\s*[^\s]+\s*=", propline): # minimal syntax check for <file-type> =
110 #transform the file type expression from autoprops into a normal regular expression.
117 # example string_proplist at this point: " svn:eol-style=native;svn:executable"
131 # unescape any ";;" in a property value, e.g. the mime-type from
132 # *.java = svn:eol-style=native;svn:mime-type=text/plain;;charset=utf-8
151 print "usage: " + sys.argv[0] + " [-f | --fix] [-h | --help]"
155 # UTF-8 file check. For text files, add a charset to the mime-type if their contents are UTF-8
156 # file_name: name of a text file.
157 # base_mime_type: svn:mime-type property value from the auto-props file (no charset= part)
158 # actual_mime_type: existing svn:mime-type property value for the file.
159 # return: svn:mime-type property value, with charset added when appropriate.
163 # If the file already has a charset in its mime-type, don't make any change.
178 bytes.decode("UTF-8")
180 print "warning: %s: not ASCII, not UTF-8" % file_name
184 print "UTF-8 file with BOM: " + file_name
186 # Append charset=utf-8.
187 return base_mime_type + ';charset=utf-8'
199 if opt in ("-h", "--help"):
202 if opt in ("-f", "--fix"):
210 output = runCommand("svn ls -R ");
218 print "Repository file not in working copy: " + f
225 actual_propval = runCommand("svn propget --strict " + propname + " '" + f + "'")
227 if propname == "svn:mime-type" and propval.find("text/") == 0:
228 … # check for UTF-8 text files, should have svn:mime-type=text/something; charset=utf8
234 if propname == "svn:eol-style" and propval == "native":
235 if os.system("grep -q -v \r '" + f + "'"):
238 os.system("sed -i s/\r// '" + f + "'");