Changeset 122311 in webkit
- Timestamp:
- Jul 11, 2012 1:34:25 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r122309 r122311 1 2012-07-11 Balazs Ankes <bank@inf.u-szeged.hu> 2 3 webkit-patch land should automatically add svn:mime-type for .png files 4 https://bugs.webkit.org/show_bug.cgi?id=75825 5 6 Reviewed by Dirk Pranke. 7 8 Refactor the png.py to avoid code duplication. 9 10 * Scripts/webkitpy/common/checksvnconfigfile.py: Added. 11 (check): 12 (config_file_path): 13 (errorstr_autoprop): 14 (errorstr_png): 15 * Scripts/webkitpy/style/checkers/png.py: 16 (PNGChecker.check): 17 * Scripts/webkitpy/tool/commands/download.py: 18 (Land): 19 * Scripts/webkitpy/tool/steps/__init__.py: 20 * Scripts/webkitpy/tool/steps/addsvnmimetypeforpng.py: Added. 21 (AddSvnMimetypeForPng): 22 (AddSvnMimetypeForPng.__init__): 23 (AddSvnMimetypeForPng.run): 24 (AddSvnMimetypeForPng._check_pngs): 25 * Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py: Added. 26 (MockSCMDetector): 27 (MockSCMDetector.__init__): 28 (MockSCMDetector.display_name): 29 (AddSvnMimetypeForPngTest): 30 (AddSvnMimetypeForPngTest.test_run): 31 1 32 2012-07-11 Hayato Ito <hayato@chromium.org> 2 33 -
trunk/Tools/Scripts/webkitpy/style/checkers/png.py
r118996 r122311 28 28 import re 29 29 30 from webkitpy.common import checksvnconfigfile 30 31 from webkitpy.common import read_checksum_from_png 31 32 from webkitpy.common.system.systemhost import SystemHost … … 55 56 56 57 if detection == "git": 57 config_file_path = self._config_file_path() 58 there_is_enable_line = False 59 there_is_png_line = False 58 (file_missing, autoprop_missing, png_missing) = checksvnconfigfile.check(self._host, self._fs) 59 config_file_path = checksvnconfigfile.config_file_path(self._host, self._fs) 60 60 61 try: 62 config_file = self._fs.read_text_file(config_file_path) 63 except IOError: 64 errorstr = "There is no " + config_file_path 65 self._handle_style_error(0, 'image/png', 5, errorstr) 66 return 67 68 errorstr_autoprop = "Have to enable auto props in the subversion config file (" + config_file_path + " \"enable-auto-props = yes\"). " 69 errorstr_png = "Have to set the svn:mime-type in the subversion config file (" + config_file_path + " \"*.png = svn:mime-type=image/png\")." 70 71 for line in config_file.split('\n'): 72 if not there_is_enable_line: 73 match = re.search("^\s*enable-auto-props\s*=\s*yes", line) 74 if match: 75 there_is_enable_line = True 76 errorstr_autoprop = "" 77 continue 78 79 if not there_is_png_line: 80 match = re.search("^\s*\*\.png\s*=\s*svn:mime-type=image/png", line) 81 if match: 82 there_is_png_line = True 83 errorstr_png = "" 84 continue 85 86 errorstr = errorstr_autoprop + errorstr_png 87 if errorstr: 88 self._handle_style_error(0, 'image/png', 5, errorstr) 61 if file_missing: 62 self._handle_style_error(0, 'image/png', 5, "There is no SVN config file. (%s)" % config_file_path) 63 elif autoprop_missing and png_missing: 64 self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_autoprop(config_file_path) + checksvnconfigfile.errorstr_png(config_file_path)) 65 elif autoprop_missing: 66 self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_autoprop(config_file_path)) 67 elif png_missing: 68 self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_png(config_file_path)) 89 69 90 70 elif detection == "svn": 91 71 prop_get = self._detector.propget("svn:mime-type", self._file_path) 92 72 if prop_get != "image/png": 93 errorstr = "Set the svn:mime-type property (svn propset svn:mime-type image/png " + self._file_path + ")."73 errorstr = "Set the svn:mime-type property (svn propset svn:mime-type image/png %s)." % self._file_path 94 74 self._handle_style_error(0, 'image/png', 5, errorstr) 95 75 96 def _config_file_path(self):97 config_file = ""98 if self._host.platform.is_win():99 config_file_path = self._fs.join(os.environ['APPDATA'], "Subversion\config")100 else:101 config_file_path = self._fs.join(self._fs.expanduser("~"), ".subversion/config")102 return config_file_path -
trunk/Tools/Scripts/webkitpy/tool/commands/download.py
r116947 r122311 91 91 show_in_main_help = True 92 92 steps = [ 93 steps.AddSvnMimetypeForPng, 93 94 steps.UpdateChangeLogsWithReviewer, 94 95 steps.ValidateReviewer, -
trunk/Tools/Scripts/webkitpy/tool/steps/__init__.py
r116947 r122311 28 28 29 29 # FIXME: Is this the right way to do this? 30 from webkitpy.tool.steps.addsvnmimetypeforpng import AddSvnMimetypeForPng 30 31 from webkitpy.tool.steps.applypatch import ApplyPatch 31 32 from webkitpy.tool.steps.applypatchwithlocalcommit import ApplyPatchWithLocalCommit
Note: See TracChangeset
for help on using the changeset viewer.