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

Side by Side Diff: tools/jsondiff.py

Issue 19112002: svndiff.py: add ability to compare before-and-after JSON files, not just raw images (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_CreateGmActualURL 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 ''' 3 '''
4 Copyright 2013 Google Inc. 4 Copyright 2013 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 ''' 8 '''
9 9
10 ''' 10 '''
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 oldfile. 151 oldfile.
152 """ 152 """
153 old_results = self._GetExpectedResults(oldfile) 153 old_results = self._GetExpectedResults(oldfile)
154 if newfile: 154 if newfile:
155 new_results = self._GetExpectedResults(newfile) 155 new_results = self._GetExpectedResults(newfile)
156 else: 156 else:
157 new_results = self._GetActualResults(oldfile) 157 new_results = self._GetActualResults(oldfile)
158 return self._DictionaryDiff(old_results, new_results) 158 return self._DictionaryDiff(old_results, new_results)
159 159
160 160
161 # main... 161 def _Main():
162 parser = argparse.ArgumentParser() 162 parser = argparse.ArgumentParser()
163 parser.add_argument('old', 163 parser.add_argument(
164 help='Path to JSON file whose expectations to display on ' + 164 'old',
165 'the "old" side of the diff. This can be a filepath on ' + 165 help='Path to JSON file whose expectations to display on ' +
166 'local storage, or a URL.') 166 'the "old" side of the diff. This can be a filepath on ' +
167 parser.add_argument('new', nargs='?', 167 'local storage, or a URL.')
168 help='Path to JSON file whose expectations to display on ' + 168 parser.add_argument(
169 'the "new" side of the diff; if not specified, uses the ' + 169 'new', nargs='?',
170 'ACTUAL results from the "old" JSON file. This can be a ' + 170 help='Path to JSON file whose expectations to display on ' +
171 'filepath on local storage, or a URL.') 171 'the "new" side of the diff; if not specified, uses the ' +
172 args = parser.parse_args() 172 'ACTUAL results from the "old" JSON file. This can be a ' +
173 differ = GMDiffer() 173 'filepath on local storage, or a URL.')
174 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new) 174 args = parser.parse_args()
175 json.dump(diffs, sys.stdout, sort_keys=True, indent=2) 175 differ = GMDiffer()
176 diffs = differ.GenerateDiffDict(oldfile=args.old, newfile=args.new)
177 json.dump(diffs, sys.stdout, sort_keys=True, indent=2)
178
179
180 if __name__ == '__main__':
181 _Main()
OLDNEW
« no previous file with comments | « gm/gm_json.py ('k') | tools/rebaseline.py » ('j') | tools/rebaseline.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698