svndiff.py: add ability to compare before-and-after JSON files, not just raw images
This should complete step 3 of https://goto.google.com/ChecksumTransitionDetail !
R=borenet@google.com
Review URL: https://codereview.chromium.org/19112002
git-svn-id: http://skia.googlecode.com/svn/trunk@10113 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/rebaseline.py b/tools/rebaseline.py
index ec5c1c9..65f157b 100755
--- a/tools/rebaseline.py
+++ b/tools/rebaseline.py
@@ -11,6 +11,8 @@
Rebaselines the given GM tests, on all bots and all configurations.
Must be run from the gm-expected directory. If run from a git or SVN
checkout, the files will be added to the staging area for commit.
+
+TODO(epoger): Fix indentation in this file (2-space indents, not 4-space).
'''
# System-level imports
@@ -146,7 +148,7 @@
self._actuals_filename = actuals_filename
self._exception_handler = exception_handler
self._add_new = add_new
- self._testname_pattern = re.compile('(\S+)_(\S+).png')
+ self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN)
# 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
@@ -230,7 +232,8 @@
skipped_images = []
if results_to_update:
for (image_name, image_results) in results_to_update.iteritems():
- (test, config) = self._testname_pattern.match(image_name).groups()
+ (test, config) = \
+ self._image_filename_re.match(image_name).groups()
if self._tests:
if test not in self._tests:
skipped_images.append(image_name)
@@ -239,10 +242,11 @@
if config not in self._configs:
skipped_images.append(image_name)
continue
- expectations_dict[gm_json.JSONKEY_EXPECTEDRESULTS] \
- [image_name] \
- [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \
- [image_results]
+ expectations_dict \
+ [gm_json.JSONKEY_EXPECTEDRESULTS] \
+ [image_name] \
+ [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \
+ [image_results]
# Write out updated expectations.
gm_json.WriteToFile(expectations_dict, expectations_json_filepath)