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

Side by Side Diff: Tools/Scripts/webkitpy/tool/steps/abstractstep.py

Issue 27055003: Remove a bunch of unused webkitpy code from tool/, common/checkout/ and common/config/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 22 matching lines...) Expand all
33 33
34 34
35 class AbstractStep(object): 35 class AbstractStep(object):
36 def __init__(self, tool, options): 36 def __init__(self, tool, options):
37 self._tool = tool 37 self._tool = tool
38 self._options = options 38 self._options = options
39 39
40 def _exit(self, code): 40 def _exit(self, code):
41 sys.exit(code) 41 sys.exit(code)
42 42
43 def _changed_files(self, state):
44 return self.cached_lookup(state, "changed_files")
45
46 _well_known_keys = {
47 # FIXME: Should this use state.get('bug_id') or state.get('patch').bug_i d() like UpdateChangeLogsWithReviewer does?
48 "bug": lambda self, state: self._tool.bugs.fetch_bug(state["bug_id"]),
49 # bug_title can either be a new title given by the user, or one from an existing bug.
50 "bug_title": lambda self, state: self.cached_lookup(state, 'bug').title( ),
51 "changed_files": lambda self, state: self._tool.scm().changed_files(self ._options.git_commit),
52 "diff": lambda self, state: self._tool.scm().create_patch(self._options. git_commit, changed_files=self._changed_files(state)),
53 # Absolute path to ChangeLog files.
54 "changelogs": lambda self, state: self._tool.checkout().modified_changel ogs(self._options.git_commit, changed_files=self._changed_files(state)),
55 }
56
57 def cached_lookup(self, state, key, promise=None):
58 if state.get(key):
59 return state[key]
60 if not promise:
61 promise = self._well_known_keys.get(key)
62 state[key] = promise(self, state)
63 return state[key]
64
65 def did_modify_checkout(self, state):
66 state["diff"] = None
67 state["changelogs"] = None
68 state["changed_files"] = None
69
70 @classmethod 43 @classmethod
71 def options(cls): 44 def options(cls):
72 return [ 45 return [
73 # We need this option here because cached_lookup uses it. :( 46 # We need this option here because cached_lookup uses it. :(
74 Options.git_commit, 47 Options.git_commit,
75 ] 48 ]
76 49
77 def run(self, state): 50 def run(self, state):
78 raise NotImplementedError, "subclasses must implement" 51 raise NotImplementedError, "subclasses must implement"
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/tool/steps/__init__.py ('k') | Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698