| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 self.Die("Please specify a branch to merge to") | 84 self.Die("Please specify a branch to merge to") |
| 85 | 85 |
| 86 self.CommonPrepare() | 86 self.CommonPrepare() |
| 87 self.PrepareBranch() | 87 self.PrepareBranch() |
| 88 | 88 |
| 89 | 89 |
| 90 class CreateBranch(Step): | 90 class CreateBranch(Step): |
| 91 MESSAGE = "Create a fresh branch for the patch." | 91 MESSAGE = "Create a fresh branch for the patch." |
| 92 | 92 |
| 93 def RunStep(self): | 93 def RunStep(self): |
| 94 args = "checkout -b %s svn/%s" % (self.Config(BRANCHNAME), | 94 self.Git("checkout -b %s svn/%s" % (self.Config(BRANCHNAME), |
| 95 self["merge_to_branch"]) | 95 self["merge_to_branch"])) |
| 96 if self.Git(args) is None: | |
| 97 self.die("Creating branch %s failed." % self.Config(BRANCHNAME)) | |
| 98 | 96 |
| 99 | 97 |
| 100 class SearchArchitecturePorts(Step): | 98 class SearchArchitecturePorts(Step): |
| 101 MESSAGE = "Search for corresponding architecture ports." | 99 MESSAGE = "Search for corresponding architecture ports." |
| 102 | 100 |
| 103 def RunStep(self): | 101 def RunStep(self): |
| 104 self["full_revision_list"] = list(OrderedDict.fromkeys(self._options.args)) | 102 self["full_revision_list"] = list(OrderedDict.fromkeys(self._options.args)) |
| 105 port_revision_list = [] | 103 port_revision_list = [] |
| 106 for revision in self["full_revision_list"]: | 104 for revision in self["full_revision_list"]: |
| 107 # Search for commits which matches the "Port rXXX" pattern. | 105 # Search for commits which matches the "Port rXXX" pattern. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 TextToFile(text, self.Config(VERSION_FILE)) | 217 TextToFile(text, self.Config(VERSION_FILE)) |
| 220 else: | 218 else: |
| 221 self.Editor(self.Config(VERSION_FILE)) | 219 self.Editor(self.Config(VERSION_FILE)) |
| 222 self.ReadAndPersistVersion("new_") | 220 self.ReadAndPersistVersion("new_") |
| 223 | 221 |
| 224 | 222 |
| 225 class CommitLocal(Step): | 223 class CommitLocal(Step): |
| 226 MESSAGE = "Commit to local branch." | 224 MESSAGE = "Commit to local branch." |
| 227 | 225 |
| 228 def RunStep(self): | 226 def RunStep(self): |
| 229 if self.Git("commit -a -F \"%s\"" % self.Config(COMMITMSG_FILE)) is None: | 227 self.Git("commit -a -F \"%s\"" % self.Config(COMMITMSG_FILE)) |
| 230 self.Die("'git commit -a' failed.") | |
| 231 | 228 |
| 232 | 229 |
| 233 class CommitRepository(Step): | 230 class CommitRepository(Step): |
| 234 MESSAGE = "Commit to the repository." | 231 MESSAGE = "Commit to the repository." |
| 235 | 232 |
| 236 def RunStep(self): | 233 def RunStep(self): |
| 237 if self.Git("checkout %s" % self.Config(BRANCHNAME)) is None: | 234 self.Git("checkout %s" % self.Config(BRANCHNAME)) |
| 238 self.Die("Cannot ensure that the current branch is %s" | |
| 239 % self.Config(BRANCHNAME)) | |
| 240 self.WaitForLGTM() | 235 self.WaitForLGTM() |
| 241 if self.Git("cl presubmit", "PRESUBMIT_TREE_CHECK=\"skip\"") is None: | 236 self.Git("cl presubmit", "PRESUBMIT_TREE_CHECK=\"skip\"") |
| 242 self.Die("Presubmit failed.") | 237 self.Git("cl dcommit -f --bypass-hooks", retry_on=lambda x: x is None) |
| 243 | |
| 244 if self.Git("cl dcommit -f --bypass-hooks", | |
| 245 retry_on=lambda x: x is None) is None: | |
| 246 self.Die("Failed to commit to %s" % self._status["merge_to_branch"]) | |
| 247 | 238 |
| 248 | 239 |
| 249 class PrepareSVN(Step): | 240 class PrepareSVN(Step): |
| 250 MESSAGE = "Determine svn commit revision." | 241 MESSAGE = "Determine svn commit revision." |
| 251 | 242 |
| 252 def RunStep(self): | 243 def RunStep(self): |
| 253 if self._options.revert_bleeding_edge: | 244 if self._options.revert_bleeding_edge: |
| 254 return | 245 return |
| 255 if self.Git("svn fetch") is None: | 246 self.Git("svn fetch") |
| 256 self.Die("'git svn fetch' failed.") | |
| 257 args = ("log -1 --format=%%H --grep=\"%s\" svn/%s" | 247 args = ("log -1 --format=%%H --grep=\"%s\" svn/%s" |
| 258 % (self["new_commit_msg"], self["merge_to_branch"])) | 248 % (self["new_commit_msg"], self["merge_to_branch"])) |
| 259 commit_hash = self.Git(args).strip() | 249 commit_hash = self.Git(args).strip() |
| 260 if not commit_hash: | 250 if not commit_hash: |
| 261 self.Die("Unable to map git commit to svn revision.") | 251 self.Die("Unable to map git commit to svn revision.") |
| 262 self["svn_revision"] = self.Git( | 252 self["svn_revision"] = self.Git( |
| 263 "svn find-rev %s" % commit_hash).strip() | 253 "svn find-rev %s" % commit_hash).strip() |
| 264 print "subversion revision number is r%s" % self["svn_revision"] | 254 print "subversion revision number is r%s" % self["svn_revision"] |
| 265 | 255 |
| 266 | 256 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 def Main(): | 356 def Main(): |
| 367 parser = BuildOptions() | 357 parser = BuildOptions() |
| 368 (options, args) = parser.parse_args() | 358 (options, args) = parser.parse_args() |
| 369 if not ProcessOptions(options, args): | 359 if not ProcessOptions(options, args): |
| 370 parser.print_help() | 360 parser.print_help() |
| 371 return 1 | 361 return 1 |
| 372 RunMergeToBranch(CONFIG, MergeToBranchOptions(options, args)) | 362 RunMergeToBranch(CONFIG, MergeToBranchOptions(options, args)) |
| 373 | 363 |
| 374 if __name__ == "__main__": | 364 if __name__ == "__main__": |
| 375 sys.exit(Main()) | 365 sys.exit(Main()) |
| OLD | NEW |