| 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 from webkitpy.common.webkit_finder import WebKitFinder |
| 6 |
| 5 | 7 |
| 6 class ChromiumCommit(object): | 8 class ChromiumCommit(object): |
| 7 | 9 |
| 8 def __init__(self, host, sha=None, position=None): | 10 def __init__(self, host, sha=None, position=None): |
| 9 """ | 11 """ |
| 10 Args: | 12 Args: |
| 11 host: A Host object | 13 host: A Host object |
| 12 sha: A Chromium commit SHA | 14 sha: A Chromium commit SHA |
| 13 position: A string of the form: | 15 position: A string of the form: |
| 14 'Cr-Commit-Position: refs/heads/master@{#431915}' | 16 'Cr-Commit-Position: refs/heads/master@{#431915}' |
| (...skipping 29 matching lines...) Expand all Loading... |
| 44 | 46 |
| 45 def subject(self): | 47 def subject(self): |
| 46 return self.host.executive.run_command([ | 48 return self.host.executive.run_command([ |
| 47 'git', 'show', '--format=%s', '--no-patch', self.sha | 49 'git', 'show', '--format=%s', '--no-patch', self.sha |
| 48 ]) | 50 ]) |
| 49 | 51 |
| 50 def body(self): | 52 def body(self): |
| 51 return self.host.executive.run_command([ | 53 return self.host.executive.run_command([ |
| 52 'git', 'show', '--format=%b', '--no-patch', self.sha | 54 'git', 'show', '--format=%b', '--no-patch', self.sha |
| 53 ]) | 55 ]) |
| 56 |
| 57 def message(self): |
| 58 """Returns a string with a commit's subject and body.""" |
| 59 return self.host.executive.run_command([ |
| 60 'git', 'show', '--format=%B', '--no-patch', self.sha |
| 61 ]) |
| 62 |
| 63 def format_patch(self): |
| 64 """Makes a patch with just changes in files in the WPT for a given commi
t.""" |
| 65 # TODO(jeffcarp): do not include expectations files |
| 66 return self.host.executive.run_command([ |
| 67 'git', 'format-patch', '-1', '--stdout', |
| 68 self.sha, self.absolute_chromium_wpt_dir() |
| 69 ]) |
| 70 |
| 71 @memoized |
| 72 def absolute_chromium_wpt_dir(self): |
| 73 finder = WebKitFinder(self.host.filesystem) |
| 74 return finder.path_from_webkit_base('LayoutTests', 'imported', 'wpt') |
| OLD | NEW |