Changeset 52599 in webkit
- Timestamp:
- Dec 28, 2009 9:06:28 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r52595 r52599 1 2009-12-28 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 [bzt] Create an ASAD command for uploading a patch 6 https://bugs.webkit.org/show_bug.cgi?id=32979 7 8 The create-review command goes through the whole process of preparing a 9 code review, including creating a bug, editing the ChangeLogs, and 10 uploading the patch. It is indeed the All Sing, All Dance upload 11 command. 12 13 * Scripts/modules/buildsteps.py: 14 * Scripts/modules/commands/upload.py: 15 * Scripts/modules/commands/upload_unittest.py: 16 * Scripts/modules/mock_bugzillatool.py: 17 * Scripts/modules/user.py: 18 1 19 2009-12-28 Adam Barth <abarth@webkit.org> 2 20 -
trunk/WebKitTools/Scripts/modules/buildsteps.py
r52528 r52599 60 60 cc = make_option("--cc", action="store", type="string", dest="cc", help="Comma-separated list of email addresses to carbon-copy.") 61 61 component = make_option("--component", action="store", type="string", dest="component", help="Component for the new bug.") 62 confirm = make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Skip confirmation steps.") 62 63 63 64 … … 161 162 162 163 164 class EditChangeLogStep(AbstractStep): 165 def run(self, state): 166 self._tool.user.edit(self._tool.scm().modified_changelogs()) 167 168 163 169 class ObsoletePatchesOnBugStep(AbstractStep): 164 170 @classmethod … … 180 186 181 187 182 class PostDiffToBugStep(AbstractStep): 188 class AbstractDiffStep(AbstractStep): 189 def diff(self, state): 190 diff = state.get("diff") 191 if not diff: 192 diff = self._tool.scm().create_patch() 193 state["diff"] = diff 194 return diff 195 196 197 class ConfirmDiffStep(AbstractDiffStep): 198 @classmethod 199 def options(cls): 200 return [ 201 CommandOptions.confirm, 202 ] 203 204 def run(self, state): 205 if not self._options.confirm: 206 return 207 diff = self.diff(state) 208 self._tool.user.page(diff) 209 if not self._tool.user.confirm(): 210 error("User declined to continue.") 211 212 213 class PostDiffToBugStep(AbstractDiffStep): 183 214 @classmethod 184 215 def options(cls): … … 190 221 191 222 def run(self, state): 192 diff = s tate.get("diff") or self._tool.scm().create_patch()223 diff = self.diff(state) 193 224 diff_file = StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object 194 225 description = self._options.description or "Patch" -
trunk/WebKitTools/Scripts/modules/commands/upload.py
r52594 r52599 37 37 38 38 from modules.bugzilla import parse_bug_id 39 from modules.buildsteps import PrepareChangeLogStep, CommandOptions, ObsoletePatchesOnBugStep, PostDiffToBugStep, PromptForBugOrTitleStep, CreateBugStep39 from modules.buildsteps import PrepareChangeLogStep, EditChangeLogStep, ConfirmDiffStep, CommandOptions, ObsoletePatchesOnBugStep, PostDiffToBugStep, PromptForBugOrTitleStep, CreateBugStep 40 40 from modules.commands.download import AbstractSequencedCommmand 41 41 from modules.comments import bug_comment_from_svn_revision … … 73 73 show_in_main_help = True 74 74 steps = [ 75 ConfirmDiffStep, 75 76 ObsoletePatchesOnBugStep, 76 77 PostDiffToBugStep, … … 98 99 CreateBugStep, 99 100 PrepareChangeLogStep, 101 ] 102 103 def _prepare_state(self, options, args, tool): 104 bug_id = args and args[0] 105 return { "bug_id" : bug_id } 106 107 108 class CreateReview(AbstractSequencedCommmand): 109 name = "create-review" 110 help_text = "Adds a ChangeLog to the current diff and posts it to a (possibly new) bug" 111 argument_names = "[BUGID]" 112 steps = [ 113 PromptForBugOrTitleStep, 114 CreateBugStep, 115 PrepareChangeLogStep, 116 EditChangeLogStep, 117 ConfirmDiffStep, 118 ObsoletePatchesOnBugStep, 119 PostDiffToBugStep, 100 120 ] 101 121 -
trunk/WebKitTools/Scripts/modules/commands/upload_unittest.py
r52528 r52599 46 46 def test_prepare_diff(self): 47 47 self.assert_execute_outputs(PrepareDiff(), []) 48 49 def test_create_review(self): 50 expected_stderr = "Obsoleting 2 old patches on bug 42\n" 51 self.assert_execute_outputs(CreateReview(), [42], expected_stderr=expected_stderr) -
trunk/WebKitTools/Scripts/modules/mock_bugzillatool.py
r52480 r52599 148 148 return "Mock user response" 149 149 150 def edit(self, files): 151 pass 152 153 def page(self, message): 154 pass 155 156 def confirm(self): 157 return True 158 150 159 151 160 class MockStatusBot(object): -
trunk/WebKitTools/Scripts/modules/user.py
r52480 r52599 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import os 30 import subprocess 31 29 32 class User(object): 30 33 def prompt(self, message): 31 34 return raw_input(message) 35 36 def edit(self, files): 37 editor = os.environ.get("EDITOR") or "vi" 38 subprocess.call([editor] + files) 39 40 def page(self, message): 41 pager = os.environ.get("PAGER") or "less" 42 child_process = subprocess.Popen([pager], stdin=subprocess.PIPE) 43 child_process.communicate(input=message) 44 45 def confirm(self): 46 response = raw_input("\nContinue? [Y/n]: ") 47 return not response or response.lower() == "y"
Note: See TracChangeset
for help on using the changeset viewer.