| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 FormatIssues("", v8bugs) | 165 FormatIssues("", v8bugs) |
| 166 FormatIssues("Chromium ", crbugs) | 166 FormatIssues("Chromium ", crbugs) |
| 167 | 167 |
| 168 if len(bug_groups) > 0: | 168 if len(bug_groups) > 0: |
| 169 return "(%s)" % ", ".join(bug_groups) | 169 return "(%s)" % ", ".join(bug_groups) |
| 170 else: | 170 else: |
| 171 return "" | 171 return "" |
| 172 | 172 |
| 173 | 173 |
| 174 def SortingKey(version): |
| 175 """Key for sorting version number strings: '3.11' > '3.2.1.1'""" |
| 176 version_keys = map(int, version.split(".")) |
| 177 # Fill up to full version numbers to normalize comparison. |
| 178 while len(version_keys) < 4: # pragma: no cover |
| 179 version_keys.append(0) |
| 180 # Fill digits. |
| 181 return ".".join(map("{0:04d}".format, version_keys)) |
| 182 |
| 183 |
| 174 # Some commands don't like the pipe, e.g. calling vi from within the script or | 184 # Some commands don't like the pipe, e.g. calling vi from within the script or |
| 175 # from subscripts like git cl upload. | 185 # from subscripts like git cl upload. |
| 176 def Command(cmd, args="", prefix="", pipe=True): | 186 def Command(cmd, args="", prefix="", pipe=True): |
| 177 # TODO(machenbach): Use timeout. | 187 # TODO(machenbach): Use timeout. |
| 178 cmd_line = "%s %s %s" % (prefix, cmd, args) | 188 cmd_line = "%s %s %s" % (prefix, cmd, args) |
| 179 print "Command: %s" % cmd_line | 189 print "Command: %s" % cmd_line |
| 180 sys.stdout.flush() | 190 sys.stdout.flush() |
| 181 try: | 191 try: |
| 182 if pipe: | 192 if pipe: |
| 183 return subprocess.check_output(cmd_line, shell=True) | 193 return subprocess.check_output(cmd_line, shell=True) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 msg = msg or "Only available in manual mode." | 372 msg = msg or "Only available in manual mode." |
| 363 self.Die(msg) | 373 self.Die(msg) |
| 364 | 374 |
| 365 def Confirm(self, msg): | 375 def Confirm(self, msg): |
| 366 print "%s [Y/n] " % msg, | 376 print "%s [Y/n] " % msg, |
| 367 answer = self.ReadLine(default="Y") | 377 answer = self.ReadLine(default="Y") |
| 368 return answer == "" or answer == "Y" or answer == "y" | 378 return answer == "" or answer == "Y" or answer == "y" |
| 369 | 379 |
| 370 def DeleteBranch(self, name): | 380 def DeleteBranch(self, name): |
| 371 for line in self.GitBranch().splitlines(): | 381 for line in self.GitBranch().splitlines(): |
| 372 if re.match(r".*\s+%s$" % name, line): | 382 if re.match(r"\*?\s*%s$" % re.escape(name), line): |
| 373 msg = "Branch %s exists, do you want to delete it?" % name | 383 msg = "Branch %s exists, do you want to delete it?" % name |
| 374 if self.Confirm(msg): | 384 if self.Confirm(msg): |
| 375 self.GitDeleteBranch(name) | 385 self.GitDeleteBranch(name) |
| 376 print "Branch %s deleted." % name | 386 print "Branch %s deleted." % name |
| 377 else: | 387 else: |
| 378 msg = "Can't continue. Please delete branch %s and try again." % name | 388 msg = "Can't continue. Please delete branch %s and try again." % name |
| 379 self.Die(msg) | 389 self.Die(msg) |
| 380 | 390 |
| 381 def InitialEnvironmentChecks(self): | 391 def InitialEnvironmentChecks(self): |
| 382 # Cancel if this is not a git checkout. | 392 # Cancel if this is not a git checkout. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 def FindLastTrunkPush(self, parent_hash="", include_patches=False): | 470 def FindLastTrunkPush(self, parent_hash="", include_patches=False): |
| 461 push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*" | 471 push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*" |
| 462 if not include_patches: | 472 if not include_patches: |
| 463 # Non-patched versions only have three numbers followed by the "(based | 473 # Non-patched versions only have three numbers followed by the "(based |
| 464 # on...) comment." | 474 # on...) comment." |
| 465 push_pattern += " (based" | 475 push_pattern += " (based" |
| 466 branch = "" if parent_hash else "svn/trunk" | 476 branch = "" if parent_hash else "svn/trunk" |
| 467 return self.GitLog(n=1, format="%H", grep=push_pattern, | 477 return self.GitLog(n=1, format="%H", grep=push_pattern, |
| 468 parent_hash=parent_hash, branch=branch) | 478 parent_hash=parent_hash, branch=branch) |
| 469 | 479 |
| 480 def ArrayToVersion(self, prefix): |
| 481 return ".".join([self[prefix + "major"], |
| 482 self[prefix + "minor"], |
| 483 self[prefix + "build"], |
| 484 self[prefix + "patch"]]) |
| 485 |
| 486 def SetVersion(self, version_file, prefix): |
| 487 output = "" |
| 488 for line in FileToText(version_file).splitlines(): |
| 489 if line.startswith("#define MAJOR_VERSION"): |
| 490 line = re.sub("\d+$", self[prefix + "major"], line) |
| 491 elif line.startswith("#define MINOR_VERSION"): |
| 492 line = re.sub("\d+$", self[prefix + "minor"], line) |
| 493 elif line.startswith("#define BUILD_NUMBER"): |
| 494 line = re.sub("\d+$", self[prefix + "build"], line) |
| 495 elif line.startswith("#define PATCH_LEVEL"): |
| 496 line = re.sub("\d+$", self[prefix + "patch"], line) |
| 497 output += "%s\n" % line |
| 498 TextToFile(output, version_file) |
| 470 | 499 |
| 471 class UploadStep(Step): | 500 class UploadStep(Step): |
| 472 MESSAGE = "Upload for code review." | 501 MESSAGE = "Upload for code review." |
| 473 | 502 |
| 474 def RunStep(self): | 503 def RunStep(self): |
| 475 if self._options.reviewer: | 504 if self._options.reviewer: |
| 476 print "Using account %s for review." % self._options.reviewer | 505 print "Using account %s for review." % self._options.reviewer |
| 477 reviewer = self._options.reviewer | 506 reviewer = self._options.reviewer |
| 478 else: | 507 else: |
| 479 print "Please enter the email address of a V8 reviewer for your patch: ", | 508 print "Please enter the email address of a V8 reviewer for your patch: ", |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 for (number, step_class) in enumerate(step_classes): | 647 for (number, step_class) in enumerate(step_classes): |
| 619 steps.append(MakeStep(step_class, number, self._state, self._config, | 648 steps.append(MakeStep(step_class, number, self._state, self._config, |
| 620 options, self._side_effect_handler)) | 649 options, self._side_effect_handler)) |
| 621 for step in steps[options.step:]: | 650 for step in steps[options.step:]: |
| 622 if step.Run(): | 651 if step.Run(): |
| 623 return 1 | 652 return 1 |
| 624 return 0 | 653 return 0 |
| 625 | 654 |
| 626 def Run(self, args=None): | 655 def Run(self, args=None): |
| 627 return self.RunSteps(self._Steps(), args) | 656 return self.RunSteps(self._Steps(), args) |
| OLD | NEW |