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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py

Issue 2655183002: In WPT importer, abort if there are exportable-but-not-yet-exported commits. (Closed)
Patch Set: Rebased Created 3 years, 10 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
OLDNEW
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 """A utility class for interacting with a local checkout of the Web Platform Tes ts.""" 5 """A utility class for interacting with a local checkout of the Web Platform Tes ts."""
6 6
7 import logging 7 import logging
8 8
9 from webkitpy.common.system.executive import ScriptError 9 from webkitpy.common.system.executive import ScriptError
10 from webkitpy.w3c.chromium_commit import ChromiumCommit 10 from webkitpy.w3c.chromium_commit import ChromiumCommit
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 if REMOTE_NAME not in self.run(['git', 'remote']): 43 if REMOTE_NAME not in self.run(['git', 'remote']):
44 self.run(['git', 'remote', 'add', REMOTE_NAME, WPT_SSH_URL]) 44 self.run(['git', 'remote', 'add', REMOTE_NAME, WPT_SSH_URL])
45 45
46 def run(self, command, **kwargs): 46 def run(self, command, **kwargs):
47 """Runs a command in the local WPT directory.""" 47 """Runs a command in the local WPT directory."""
48 return self.host.executive.run_command(command, cwd=self.path, **kwargs) 48 return self.host.executive.run_command(command, cwd=self.path, **kwargs)
49 49
50 def most_recent_chromium_commit(self): 50 def most_recent_chromium_commit(self):
51 """Finds the most recent commit in WPT with a Chromium commit position." "" 51 """Finds the most recent commit in WPT with a Chromium commit position." ""
52 sha = self.run(['git', 'rev-list', 'HEAD', '-n', '1', '--grep=Cr-Commit- Position']) 52 wpt_commit_hash = self.run(['git', 'rev-list', 'HEAD', '-n', '1', '--gre p=Cr-Commit-Position'])
53 if not sha: 53 if not wpt_commit_hash:
54 return None, None 54 return None, None
55 55
56 sha = sha.strip() 56 wpt_commit_hash = wpt_commit_hash.strip()
57 position = self.run(['git', 'footers', '--position', sha]) 57 position = self.run(['git', 'footers', '--position', wpt_commit_hash])
58 position = position.strip() 58 position = position.strip()
59 assert position 59 assert position
60 60
61 chromium_commit = ChromiumCommit(self.host, position=position) 61 chromium_commit = ChromiumCommit(self.host, position=position)
62 return sha, chromium_commit 62 return wpt_commit_hash, chromium_commit
63 63
64 def clean(self): 64 def clean(self):
65 self.run(['git', 'reset', '--hard', 'HEAD']) 65 self.run(['git', 'reset', '--hard', 'HEAD'])
66 self.run(['git', 'clean', '-fdx']) 66 self.run(['git', 'clean', '-fdx'])
67 self.run(['git', 'checkout', 'origin/master']) 67 self.run(['git', 'checkout', 'origin/master'])
68 if self.branch_name in self.all_branches(): 68 if self.branch_name in self.all_branches():
69 self.run(['git', 'branch', '-D', self.branch_name]) 69 self.run(['git', 'branch', '-D', self.branch_name])
70 70
71 def all_branches(self): 71 def all_branches(self):
72 """Returns a list of local and remote branches.""" 72 """Returns a list of local and remote branches."""
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 def commits_behind_master(self, commit): 129 def commits_behind_master(self, commit):
130 """Returns the number of commits after the given commit on origin/master . 130 """Returns the number of commits after the given commit on origin/master .
131 131
132 This doesn't include the given commit, and this assumes that the given 132 This doesn't include the given commit, and this assumes that the given
133 commit is on the the master branch. 133 commit is on the the master branch.
134 """ 134 """
135 return len(self.run([ 135 return len(self.run([
136 'git', 'rev-list', '{}..origin/master'.format(commit) 136 'git', 'rev-list', '{}..origin/master'.format(commit)
137 ]).splitlines()) 137 ]).splitlines())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698