| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Util functions for git repository processing for delta test.""" | 5 """Util functions for git repository processing for delta test.""" |
| 6 | 6 |
| 7 import base64 | 7 import base64 |
| 8 import hashlib | 8 import hashlib |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 EnsureDirExists(file_path) | 93 EnsureDirExists(file_path) |
| 94 def _EncodeStr(string): | 94 def _EncodeStr(string): |
| 95 return string.replace('\"', '\'') if string else '' | 95 return string.replace('\"', '\'') if string else '' |
| 96 | 96 |
| 97 print 'Writing delta diff to %s\n' % file_path | 97 print 'Writing delta diff to %s\n' % file_path |
| 98 with open(file_path, 'wb') as f: | 98 with open(file_path, 'wb') as f: |
| 99 f.write('Delta between githash1 %s and githash2 %s on %d crashes\n\n' % ( | 99 f.write('Delta between githash1 %s and githash2 %s on %d crashes\n\n' % ( |
| 100 git_hash1, git_hash2, crash_num)) | 100 git_hash1, git_hash2, crash_num)) |
| 101 f.write('crash url, project, components, cls, regression_range\n') | 101 f.write('crash url, project, components, cls, regression_range\n') |
| 102 for crash_id, delta in deltas.iteritems(): | 102 for crash_id, delta in deltas.iteritems(): |
| 103 delta_str_dict = delta.delta_str_dict | 103 delta_dict_str = delta.delta_dict_str |
| 104 feedback_url = _FRACAS_FEEDBACK_URL_TEMPLATE % (app_id, crash_id) | 104 feedback_url = _FRACAS_FEEDBACK_URL_TEMPLATE % (app_id, crash_id) |
| 105 f.write('%s, "%s", "%s", "%s", "%s"\n' % ( | 105 f.write('%s, "%s", "%s", "%s", "%s"\n' % ( |
| 106 feedback_url, | 106 feedback_url, |
| 107 _EncodeStr(delta_str_dict.get('suspected_project', '')), | 107 _EncodeStr(delta_dict_str.get('suspected_project', '')), |
| 108 _EncodeStr(delta_str_dict.get('suspected_components', '')), | 108 _EncodeStr(delta_dict_str.get('suspected_components', '')), |
| 109 _EncodeStr(delta_str_dict.get('suspected_cls', '')), | 109 _EncodeStr(delta_dict_str.get('suspected_cls', '')), |
| 110 _EncodeStr(delta_str_dict.get('regression_range', '')) | 110 _EncodeStr(delta_dict_str.get('regression_range', '')) |
| 111 )) | 111 )) |
| OLD | NEW |