Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: tools/rebaseline.py

Issue 20017009: rebaseline.py: set text mimetype for all .json files, so text diffs work (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/rebaseline.py
===================================================================
--- tools/rebaseline.py (revision 10309)
+++ tools/rebaseline.py (working copy)
@@ -17,6 +17,7 @@
import argparse
import os
import re
+import subprocess
import sys
import urllib2
@@ -147,7 +148,14 @@
self._exception_handler = exception_handler
self._add_new = add_new
self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN)
+ self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn'))
+ # Executes subprocess.call(cmd).
+ # Raises an Exception if the command fails.
+ def _Call(self, cmd):
+ if subprocess.call(cmd) != 0:
+ raise _InternalException('error running command: ' + ' '.join(cmd))
+
# Returns the full contents of filepath, as a single string.
# If filepath looks like a URL, try to read it that way instead of as
# a path on local storage.
@@ -254,6 +262,11 @@
# Write out updated expectations.
gm_json.WriteToFile(expectations_dict, expectations_json_filepath)
+ # Mark the JSON file as plaintext, so text-style diffs can be applied.
+ # Fixes https://code.google.com/p/skia/issues/detail?id=1442
+ if self._using_svn:
+ self._Call(['svn', 'propset', '--quiet', 'svn:mime-type',
+ 'text/x-json', expectations_json_filepath])
# main...
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698