| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
| 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 | 10 # copyright notice, this list of conditions and the following |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class Preparation(Step): | 41 class Preparation(Step): |
| 42 MESSAGE = "Preparation." | 42 MESSAGE = "Preparation." |
| 43 | 43 |
| 44 def RunStep(self): | 44 def RunStep(self): |
| 45 self.InitialEnvironmentChecks(self.default_cwd) | 45 self.InitialEnvironmentChecks(self.default_cwd) |
| 46 self.CommonPrepare() | 46 self.CommonPrepare() |
| 47 | 47 |
| 48 # Make sure tags are fetched. | 48 # Make sure tags are fetched. |
| 49 self.Git("fetch origin +refs/tags/*:refs/tags/*") | 49 self.Git("fetch origin +refs/tags/*:refs/tags/*") |
| 50 | 50 |
| 51 if(self["current_branch"] == self.Config("TRUNKBRANCH") | 51 if(self["current_branch"] == self.Config("CANDIDATESBRANCH") |
| 52 or self["current_branch"] == self.Config("BRANCHNAME")): | 52 or self["current_branch"] == self.Config("BRANCHNAME")): |
| 53 print "Warning: Script started on branch %s" % self["current_branch"] | 53 print "Warning: Script started on branch %s" % self["current_branch"] |
| 54 | 54 |
| 55 self.PrepareBranch() | 55 self.PrepareBranch() |
| 56 self.DeleteBranch(self.Config("TRUNKBRANCH")) | 56 self.DeleteBranch(self.Config("CANDIDATESBRANCH")) |
| 57 | 57 |
| 58 | 58 |
| 59 class FreshBranch(Step): | 59 class FreshBranch(Step): |
| 60 MESSAGE = "Create a fresh branch." | 60 MESSAGE = "Create a fresh branch." |
| 61 | 61 |
| 62 def RunStep(self): | 62 def RunStep(self): |
| 63 self.GitCreateBranch(self.Config("BRANCHNAME"), | 63 self.GitCreateBranch(self.Config("BRANCHNAME"), |
| 64 self.vc.RemoteMasterBranch()) | 64 self.vc.RemoteMasterBranch()) |
| 65 | 65 |
| 66 | 66 |
| 67 class PreparePushRevision(Step): | 67 class PreparePushRevision(Step): |
| 68 MESSAGE = "Check which revision to push." | 68 MESSAGE = "Check which revision to push." |
| 69 | 69 |
| 70 def RunStep(self): | 70 def RunStep(self): |
| 71 if self._options.revision: | 71 if self._options.revision: |
| 72 self["push_hash"] = self._options.revision | 72 self["push_hash"] = self._options.revision |
| 73 else: | 73 else: |
| 74 self["push_hash"] = self.GitLog(n=1, format="%H", git_hash="HEAD") | 74 self["push_hash"] = self.GitLog(n=1, format="%H", git_hash="HEAD") |
| 75 if not self["push_hash"]: # pragma: no cover | 75 if not self["push_hash"]: # pragma: no cover |
| 76 self.Die("Could not determine the git hash for the push.") | 76 self.Die("Could not determine the git hash for the push.") |
| 77 | 77 |
| 78 | 78 |
| 79 class DetectLastPush(Step): | 79 class DetectLastPush(Step): |
| 80 MESSAGE = "Detect commit ID of last push to trunk." | 80 MESSAGE = "Detect commit ID of last push to CANDIDATES." |
| 81 | 81 |
| 82 def RunStep(self): | 82 def RunStep(self): |
| 83 last_push = self._options.last_push or self.FindLastTrunkPush() | 83 last_push = self._options.last_push or self.FindLastCandidatesPush() |
| 84 while True: | 84 while True: |
| 85 # Print assumed commit, circumventing git's pager. | 85 # Print assumed commit, circumventing git's pager. |
| 86 print self.GitLog(n=1, git_hash=last_push) | 86 print self.GitLog(n=1, git_hash=last_push) |
| 87 if self.Confirm("Is the commit printed above the last push to trunk?"): | 87 if self.Confirm( |
| 88 "Is the commit printed above the last push to candidates?"): |
| 88 break | 89 break |
| 89 last_push = self.FindLastTrunkPush(parent_hash=last_push) | 90 last_push = self.FindLastCandidatesPush(parent_hash=last_push) |
| 90 | 91 |
| 91 if self._options.last_bleeding_edge: | 92 if self._options.last_master: |
| 92 # Read the bleeding edge revision of the last push from a command-line | 93 # Read the master revision of the last push from a command-line option. |
| 93 # option. | 94 last_push_master = self._options.last_master |
| 94 last_push_bleeding_edge = self._options.last_bleeding_edge | |
| 95 else: | 95 else: |
| 96 # Retrieve the bleeding edge revision of the last push from the text in | 96 # Retrieve the master revision of the last push from the text in |
| 97 # the push commit message. | 97 # the push commit message. |
| 98 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) | 98 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) |
| 99 last_push_bleeding_edge = PUSH_MSG_GIT_RE.match( | 99 last_push_master = PUSH_MSG_GIT_RE.match( |
| 100 last_push_title).group("git_rev") | 100 last_push_title).group("git_rev") |
| 101 | 101 |
| 102 if not last_push_bleeding_edge: # pragma: no cover | 102 if not last_push_master: # pragma: no cover |
| 103 self.Die("Could not retrieve bleeding edge git hash for trunk push %s" | 103 self.Die( |
| 104 % last_push) | 104 "Could not retrieve master git hash for candidates push %s" |
| 105 % last_push) |
| 105 | 106 |
| 106 # This points to the git hash of the last push on trunk. | 107 # This points to the git hash of the last push on candidates. |
| 107 self["last_push_trunk"] = last_push | 108 self["last_push_candidates"] = last_push |
| 108 # This points to the last bleeding_edge revision that went into the last | 109 # This points to the last master revision that went into the last |
| 109 # push. | 110 # push. |
| 110 # TODO(machenbach): Do we need a check to make sure we're not pushing a | 111 # TODO(machenbach): Do we need a check to make sure we're not pushing a |
| 111 # revision older than the last push? If we do this, the output of the | 112 # revision older than the last push? If we do this, the output of the |
| 112 # current change log preparation won't make much sense. | 113 # current change log preparation won't make much sense. |
| 113 self["last_push_bleeding_edge"] = last_push_bleeding_edge | 114 self["last_push_master"] = last_push_master |
| 114 | 115 |
| 115 | 116 |
| 116 class GetLatestVersion(Step): | 117 class GetLatestVersion(Step): |
| 117 MESSAGE = "Get latest version from tags." | 118 MESSAGE = "Get latest version from tags." |
| 118 | 119 |
| 119 def RunStep(self): | 120 def RunStep(self): |
| 120 versions = sorted(filter(VERSION_RE.match, self.vc.GetTags()), | 121 versions = sorted(filter(VERSION_RE.match, self.vc.GetTags()), |
| 121 key=SortingKey, reverse=True) | 122 key=SortingKey, reverse=True) |
| 122 self.StoreVersion(versions[0], "latest_") | 123 self.StoreVersion(versions[0], "latest_") |
| 123 self["latest_version"] = self.ArrayToVersion("latest_") | 124 self["latest_version"] = self.ArrayToVersion("latest_") |
| 124 | 125 |
| 125 # The version file on master can be used to bump up major/minor at | 126 # The version file on master can be used to bump up major/minor at |
| 126 # branch time. | 127 # branch time. |
| 127 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteMasterBranch()) | 128 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteMasterBranch()) |
| 128 self.ReadAndPersistVersion("master_") | 129 self.ReadAndPersistVersion("master_") |
| 129 self["master_version"] = self.ArrayToVersion("master_") | 130 self["master_version"] = self.ArrayToVersion("master_") |
| 130 | 131 |
| 131 if SortingKey(self["master_version"]) > SortingKey(self["latest_version"]): | 132 if SortingKey(self["master_version"]) > SortingKey(self["latest_version"]): |
| 132 self["latest_version"] = self["master_version"] | 133 self["latest_version"] = self["master_version"] |
| 133 self.StoreVersion(self["latest_version"], "latest_") | 134 self.StoreVersion(self["latest_version"], "latest_") |
| 134 | 135 |
| 135 print "Determined latest version %s" % self["latest_version"] | 136 print "Determined latest version %s" % self["latest_version"] |
| 136 | 137 |
| 137 | 138 |
| 138 class IncrementVersion(Step): | 139 class IncrementVersion(Step): |
| 139 MESSAGE = "Increment version number." | 140 MESSAGE = "Increment version number." |
| 140 | 141 |
| 141 def RunStep(self): | 142 def RunStep(self): |
| 142 # Variables prefixed with 'new_' contain the new version numbers for the | 143 # Variables prefixed with 'new_' contain the new version numbers for the |
| 143 # ongoing trunk push. | 144 # ongoing candidates push. |
| 144 self["new_major"] = self["latest_major"] | 145 self["new_major"] = self["latest_major"] |
| 145 self["new_minor"] = self["latest_minor"] | 146 self["new_minor"] = self["latest_minor"] |
| 146 self["new_build"] = str(int(self["latest_build"]) + 1) | 147 self["new_build"] = str(int(self["latest_build"]) + 1) |
| 147 | 148 |
| 148 # Make sure patch level is 0 in a new push. | 149 # Make sure patch level is 0 in a new push. |
| 149 self["new_patch"] = "0" | 150 self["new_patch"] = "0" |
| 150 | 151 |
| 151 self["version"] = "%s.%s.%s" % (self["new_major"], | 152 self["version"] = "%s.%s.%s" % (self["new_major"], |
| 152 self["new_minor"], | 153 self["new_minor"], |
| 153 self["new_build"]) | 154 self["new_build"]) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 172 body = self.ReadURL(cl_url, wait_plan=[1]) | 173 body = self.ReadURL(cl_url, wait_plan=[1]) |
| 173 except urllib2.URLError: # pragma: no cover | 174 except urllib2.URLError: # pragma: no cover |
| 174 pass | 175 pass |
| 175 return body | 176 return body |
| 176 | 177 |
| 177 def RunStep(self): | 178 def RunStep(self): |
| 178 self["date"] = self.GetDate() | 179 self["date"] = self.GetDate() |
| 179 output = "%s: Version %s\n\n" % (self["date"], self["version"]) | 180 output = "%s: Version %s\n\n" % (self["date"], self["version"]) |
| 180 TextToFile(output, self.Config("CHANGELOG_ENTRY_FILE")) | 181 TextToFile(output, self.Config("CHANGELOG_ENTRY_FILE")) |
| 181 commits = self.GitLog(format="%H", | 182 commits = self.GitLog(format="%H", |
| 182 git_hash="%s..%s" % (self["last_push_bleeding_edge"], | 183 git_hash="%s..%s" % (self["last_push_master"], |
| 183 self["push_hash"])) | 184 self["push_hash"])) |
| 184 | 185 |
| 185 # Cache raw commit messages. | 186 # Cache raw commit messages. |
| 186 commit_messages = [ | 187 commit_messages = [ |
| 187 [ | 188 [ |
| 188 self.GitLog(n=1, format="%s", git_hash=commit), | 189 self.GitLog(n=1, format="%s", git_hash=commit), |
| 189 self.Reload(self.GitLog(n=1, format="%B", git_hash=commit)), | 190 self.Reload(self.GitLog(n=1, format="%B", git_hash=commit)), |
| 190 self.GitLog(n=1, format="%an", git_hash=commit), | 191 self.GitLog(n=1, format="%an", git_hash=commit), |
| 191 ] for commit in commits.splitlines() | 192 ] for commit in commits.splitlines() |
| 192 ] | 193 ] |
| (...skipping 25 matching lines...) Expand all Loading... |
| 218 | 219 |
| 219 # Strip comments and reformat with correct indentation. | 220 # Strip comments and reformat with correct indentation. |
| 220 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")).rstrip() | 221 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")).rstrip() |
| 221 changelog_entry = StripComments(changelog_entry) | 222 changelog_entry = StripComments(changelog_entry) |
| 222 changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines())) | 223 changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines())) |
| 223 changelog_entry = changelog_entry.lstrip() | 224 changelog_entry = changelog_entry.lstrip() |
| 224 | 225 |
| 225 if changelog_entry == "": # pragma: no cover | 226 if changelog_entry == "": # pragma: no cover |
| 226 self.Die("Empty ChangeLog entry.") | 227 self.Die("Empty ChangeLog entry.") |
| 227 | 228 |
| 228 # Safe new change log for adding it later to the trunk patch. | 229 # Safe new change log for adding it later to the candidates patch. |
| 229 TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE")) | 230 TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE")) |
| 230 | 231 |
| 231 | 232 |
| 232 class StragglerCommits(Step): | 233 class StragglerCommits(Step): |
| 233 MESSAGE = ("Fetch straggler commits that sneaked in since this script was " | 234 MESSAGE = ("Fetch straggler commits that sneaked in since this script was " |
| 234 "started.") | 235 "started.") |
| 235 | 236 |
| 236 def RunStep(self): | 237 def RunStep(self): |
| 237 self.vc.Fetch() | 238 self.vc.Fetch() |
| 238 self.GitCheckout(self.vc.RemoteMasterBranch()) | 239 self.GitCheckout(self.vc.RemoteMasterBranch()) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 265 strip = lambda line: line.strip() | 266 strip = lambda line: line.strip() |
| 266 text = SplitMapJoin("\n\n", SplitMapJoin("\n", strip, " "), "\n\n")(text) | 267 text = SplitMapJoin("\n\n", SplitMapJoin("\n", strip, " "), "\n\n")(text) |
| 267 | 268 |
| 268 if not text: # pragma: no cover | 269 if not text: # pragma: no cover |
| 269 self.Die("Commit message editing failed.") | 270 self.Die("Commit message editing failed.") |
| 270 self["commit_title"] = text.splitlines()[0] | 271 self["commit_title"] = text.splitlines()[0] |
| 271 TextToFile(text, self.Config("COMMITMSG_FILE")) | 272 TextToFile(text, self.Config("COMMITMSG_FILE")) |
| 272 | 273 |
| 273 | 274 |
| 274 class NewBranch(Step): | 275 class NewBranch(Step): |
| 275 MESSAGE = "Create a new branch from trunk." | 276 MESSAGE = "Create a new branch from candidates." |
| 276 | 277 |
| 277 def RunStep(self): | 278 def RunStep(self): |
| 278 self.GitCreateBranch(self.Config("TRUNKBRANCH"), | 279 self.GitCreateBranch(self.Config("CANDIDATESBRANCH"), |
| 279 self.vc.RemoteCandidateBranch()) | 280 self.vc.RemoteCandidateBranch()) |
| 280 | 281 |
| 281 | 282 |
| 282 class ApplyChanges(Step): | 283 class ApplyChanges(Step): |
| 283 MESSAGE = "Apply squashed changes." | 284 MESSAGE = "Apply squashed changes." |
| 284 | 285 |
| 285 def RunStep(self): | 286 def RunStep(self): |
| 286 self.ApplyPatch(self.Config("PATCH_FILE")) | 287 self.ApplyPatch(self.Config("PATCH_FILE")) |
| 287 os.remove(self.Config("PATCH_FILE")) | 288 os.remove(self.Config("PATCH_FILE")) |
| 288 # The change log has been modified by the patch. Reset it to the version | 289 # The change log has been modified by the patch. Reset it to the version |
| 289 # on trunk and apply the exact changes determined by this PrepareChangeLog | 290 # on candidates and apply the exact changes determined by this |
| 290 # step above. | 291 # PrepareChangeLog step above. |
| 291 self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch()) | 292 self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch()) |
| 292 # The version file has been modified by the patch. Reset it to the version | 293 # The version file has been modified by the patch. Reset it to the version |
| 293 # on trunk. | 294 # on candidates. |
| 294 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch()) | 295 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch()) |
| 295 | 296 |
| 296 | 297 |
| 297 class CommitSquash(Step): | 298 class CommitSquash(Step): |
| 298 MESSAGE = "Commit to local candidates branch." | 299 MESSAGE = "Commit to local candidates branch." |
| 299 | 300 |
| 300 def RunStep(self): | 301 def RunStep(self): |
| 301 # Make a first commit with a slightly different title to not confuse | 302 # Make a first commit with a slightly different title to not confuse |
| 302 # the tagging. | 303 # the tagging. |
| 303 msg = FileToText(self.Config("COMMITMSG_FILE")).splitlines() | 304 msg = FileToText(self.Config("COMMITMSG_FILE")).splitlines() |
| 304 msg[0] = msg[0].replace("(based on", "(squashed - based on") | 305 msg[0] = msg[0].replace("(based on", "(squashed - based on") |
| 305 self.GitCommit(message = "\n".join(msg)) | 306 self.GitCommit(message = "\n".join(msg)) |
| 306 | 307 |
| 307 | 308 |
| 308 class PrepareVersionBranch(Step): | 309 class PrepareVersionBranch(Step): |
| 309 MESSAGE = "Prepare new branch to commit version and changelog file." | 310 MESSAGE = "Prepare new branch to commit version and changelog file." |
| 310 | 311 |
| 311 def RunStep(self): | 312 def RunStep(self): |
| 312 self.GitCheckout("master") | 313 self.GitCheckout("master") |
| 313 self.Git("fetch") | 314 self.Git("fetch") |
| 314 self.GitDeleteBranch(self.Config("TRUNKBRANCH")) | 315 self.GitDeleteBranch(self.Config("CANDIDATESBRANCH")) |
| 315 self.GitCreateBranch(self.Config("TRUNKBRANCH"), | 316 self.GitCreateBranch(self.Config("CANDIDATESBRANCH"), |
| 316 self.vc.RemoteCandidateBranch()) | 317 self.vc.RemoteCandidateBranch()) |
| 317 | 318 |
| 318 | 319 |
| 319 class AddChangeLog(Step): | 320 class AddChangeLog(Step): |
| 320 MESSAGE = "Add ChangeLog changes to trunk branch." | 321 MESSAGE = "Add ChangeLog changes to candidates branch." |
| 321 | 322 |
| 322 def RunStep(self): | 323 def RunStep(self): |
| 323 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) | 324 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) |
| 324 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) | 325 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) |
| 325 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) | 326 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) |
| 326 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) | 327 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) |
| 327 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) | 328 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) |
| 328 | 329 |
| 329 | 330 |
| 330 class SetVersion(Step): | 331 class SetVersion(Step): |
| 331 MESSAGE = "Set correct version for trunk." | 332 MESSAGE = "Set correct version for candidates." |
| 332 | 333 |
| 333 def RunStep(self): | 334 def RunStep(self): |
| 334 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") | 335 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") |
| 335 | 336 |
| 336 | 337 |
| 337 class CommitCandidate(Step): | 338 class CommitCandidate(Step): |
| 338 MESSAGE = "Commit version and changelog to local candidates branch." | 339 MESSAGE = "Commit version and changelog to local candidates branch." |
| 339 | 340 |
| 340 def RunStep(self): | 341 def RunStep(self): |
| 341 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) | 342 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) |
| 342 os.remove(self.Config("COMMITMSG_FILE")) | 343 os.remove(self.Config("COMMITMSG_FILE")) |
| 343 | 344 |
| 344 | 345 |
| 345 class SanityCheck(Step): | 346 class SanityCheck(Step): |
| 346 MESSAGE = "Sanity check." | 347 MESSAGE = "Sanity check." |
| 347 | 348 |
| 348 def RunStep(self): | 349 def RunStep(self): |
| 349 # TODO(machenbach): Run presubmit script here as it is now missing in the | 350 # TODO(machenbach): Run presubmit script here as it is now missing in the |
| 350 # prepare push process. | 351 # prepare push process. |
| 351 if not self.Confirm("Please check if your local checkout is sane: Inspect " | 352 if not self.Confirm("Please check if your local checkout is sane: Inspect " |
| 352 "%s, compile, run tests. Do you want to commit this new trunk " | 353 "%s, compile, run tests. Do you want to commit this new candidates " |
| 353 "revision to the repository?" % VERSION_FILE): | 354 "revision to the repository?" % VERSION_FILE): |
| 354 self.Die("Execution canceled.") # pragma: no cover | 355 self.Die("Execution canceled.") # pragma: no cover |
| 355 | 356 |
| 356 | 357 |
| 357 class Land(Step): | 358 class Land(Step): |
| 358 MESSAGE = "Land the patch." | 359 MESSAGE = "Land the patch." |
| 359 | 360 |
| 360 def RunStep(self): | 361 def RunStep(self): |
| 361 self.vc.CLLand() | 362 self.vc.CLLand() |
| 362 | 363 |
| 363 | 364 |
| 364 class TagRevision(Step): | 365 class TagRevision(Step): |
| 365 MESSAGE = "Tag the new revision." | 366 MESSAGE = "Tag the new revision." |
| 366 | 367 |
| 367 def RunStep(self): | 368 def RunStep(self): |
| 368 self.vc.Tag( | 369 self.vc.Tag( |
| 369 self["version"], self.vc.RemoteCandidateBranch(), self["commit_title"]) | 370 self["version"], self.vc.RemoteCandidateBranch(), self["commit_title"]) |
| 370 | 371 |
| 371 | 372 |
| 372 class CleanUp(Step): | 373 class CleanUp(Step): |
| 373 MESSAGE = "Done!" | 374 MESSAGE = "Done!" |
| 374 | 375 |
| 375 def RunStep(self): | 376 def RunStep(self): |
| 376 print("Congratulations, you have successfully created the trunk " | 377 print("Congratulations, you have successfully created the candidates " |
| 377 "revision %s." | 378 "revision %s." |
| 378 % self["version"]) | 379 % self["version"]) |
| 379 | 380 |
| 380 self.CommonCleanup() | 381 self.CommonCleanup() |
| 381 if self.Config("TRUNKBRANCH") != self["current_branch"]: | 382 if self.Config("CANDIDATESBRANCH") != self["current_branch"]: |
| 382 self.GitDeleteBranch(self.Config("TRUNKBRANCH")) | 383 self.GitDeleteBranch(self.Config("CANDIDATESBRANCH")) |
| 383 | 384 |
| 384 | 385 |
| 385 class PushToTrunk(ScriptsBase): | 386 class PushToCandidates(ScriptsBase): |
| 386 def _PrepareOptions(self, parser): | 387 def _PrepareOptions(self, parser): |
| 387 group = parser.add_mutually_exclusive_group() | 388 group = parser.add_mutually_exclusive_group() |
| 388 group.add_argument("-f", "--force", | 389 group.add_argument("-f", "--force", |
| 389 help="Don't prompt the user.", | 390 help="Don't prompt the user.", |
| 390 default=False, action="store_true") | 391 default=False, action="store_true") |
| 391 group.add_argument("-m", "--manual", | 392 group.add_argument("-m", "--manual", |
| 392 help="Prompt the user at every important step.", | 393 help="Prompt the user at every important step.", |
| 393 default=False, action="store_true") | 394 default=False, action="store_true") |
| 394 parser.add_argument("-b", "--last-bleeding-edge", | 395 parser.add_argument("-b", "--last-master", |
| 395 help=("The git commit ID of the last bleeding edge " | 396 help=("The git commit ID of the last master " |
| 396 "revision that was pushed to trunk. This is " | 397 "revision that was pushed to candidates. This is" |
| 397 "used for the auto-generated ChangeLog entry.")) | 398 " used for the auto-generated ChangeLog entry.")) |
| 398 parser.add_argument("-l", "--last-push", | 399 parser.add_argument("-l", "--last-push", |
| 399 help="The git commit ID of the last push to trunk.") | 400 help="The git commit ID of the last candidates push.") |
| 400 parser.add_argument("-R", "--revision", | 401 parser.add_argument("-R", "--revision", |
| 401 help="The git commit ID to push (defaults to HEAD).") | 402 help="The git commit ID to push (defaults to HEAD).") |
| 402 | 403 |
| 403 def _ProcessOptions(self, options): # pragma: no cover | 404 def _ProcessOptions(self, options): # pragma: no cover |
| 404 if not options.manual and not options.reviewer: | 405 if not options.manual and not options.reviewer: |
| 405 print "A reviewer (-r) is required in (semi-)automatic mode." | 406 print "A reviewer (-r) is required in (semi-)automatic mode." |
| 406 return False | 407 return False |
| 407 if not options.manual and not options.author: | 408 if not options.manual and not options.author: |
| 408 print "Specify your chromium.org email with -a in (semi-)automatic mode." | 409 print "Specify your chromium.org email with -a in (semi-)automatic mode." |
| 409 return False | 410 return False |
| 410 | 411 |
| 411 options.tbr_commit = not options.manual | 412 options.tbr_commit = not options.manual |
| 412 return True | 413 return True |
| 413 | 414 |
| 414 def _Config(self): | 415 def _Config(self): |
| 415 return { | 416 return { |
| 416 "BRANCHNAME": "prepare-push", | 417 "BRANCHNAME": "prepare-push", |
| 417 "TRUNKBRANCH": "trunk-push", | 418 "CANDIDATESBRANCH": "candidates-push", |
| 418 "PERSISTFILE_BASENAME": "/tmp/v8-push-to-trunk-tempfile", | 419 "PERSISTFILE_BASENAME": "/tmp/v8-push-to-candidates-tempfile", |
| 419 "CHANGELOG_ENTRY_FILE": "/tmp/v8-push-to-trunk-tempfile-changelog-entry", | 420 "CHANGELOG_ENTRY_FILE": |
| 420 "PATCH_FILE": "/tmp/v8-push-to-trunk-tempfile-patch-file", | 421 "/tmp/v8-push-to-candidates-tempfile-changelog-entry", |
| 421 "COMMITMSG_FILE": "/tmp/v8-push-to-trunk-tempfile-commitmsg", | 422 "PATCH_FILE": "/tmp/v8-push-to-candidates-tempfile-patch-file", |
| 423 "COMMITMSG_FILE": "/tmp/v8-push-to-candidates-tempfile-commitmsg", |
| 422 } | 424 } |
| 423 | 425 |
| 424 def _Steps(self): | 426 def _Steps(self): |
| 425 return [ | 427 return [ |
| 426 Preparation, | 428 Preparation, |
| 427 FreshBranch, | 429 FreshBranch, |
| 428 PreparePushRevision, | 430 PreparePushRevision, |
| 429 DetectLastPush, | 431 DetectLastPush, |
| 430 GetLatestVersion, | 432 GetLatestVersion, |
| 431 IncrementVersion, | 433 IncrementVersion, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 442 AddChangeLog, | 444 AddChangeLog, |
| 443 SetVersion, | 445 SetVersion, |
| 444 CommitCandidate, | 446 CommitCandidate, |
| 445 Land, | 447 Land, |
| 446 TagRevision, | 448 TagRevision, |
| 447 CleanUp, | 449 CleanUp, |
| 448 ] | 450 ] |
| 449 | 451 |
| 450 | 452 |
| 451 if __name__ == "__main__": # pragma: no cover | 453 if __name__ == "__main__": # pragma: no cover |
| 452 sys.exit(PushToTrunk().Run()) | 454 sys.exit(PushToCandidates().Run()) |
| OLD | NEW |