OLD | NEW |
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 Loading... |
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() |
OLD | NEW |