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