| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 bugs = [] | 152 bugs = [] |
| 153 for commit_hash in self["patch_commit_hashes"]: | 153 for commit_hash in self["patch_commit_hashes"]: |
| 154 msg = self.GitLog(n=1, git_hash=commit_hash) | 154 msg = self.GitLog(n=1, git_hash=commit_hash) |
| 155 for bug in re.findall(r"^[ \t]*BUG[ \t]*=[ \t]*(.*?)[ \t]*$", msg, | 155 for bug in re.findall(r"^[ \t]*BUG[ \t]*=[ \t]*(.*?)[ \t]*$", msg, |
| 156 re.M): | 156 re.M): |
| 157 bugs.extend(map(lambda s: s.strip(), bug.split(","))) | 157 bugs.extend(map(lambda s: s.strip(), bug.split(","))) |
| 158 bug_aggregate = ",".join(sorted(bugs)) | 158 bug_aggregate = ",".join(sorted(bugs)) |
| 159 if bug_aggregate: | 159 if bug_aggregate: |
| 160 self["new_commit_msg"] += "BUG=%s\nLOG=N\n" % bug_aggregate | 160 self["new_commit_msg"] += "BUG=%s\nLOG=N\n" % bug_aggregate |
| 161 TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE)) | |
| 162 | 161 |
| 163 | 162 |
| 164 class ApplyPatches(Step): | 163 class ApplyPatches(Step): |
| 165 MESSAGE = "Apply patches for selected revisions." | 164 MESSAGE = "Apply patches for selected revisions." |
| 166 | 165 |
| 167 def RunStep(self): | 166 def RunStep(self): |
| 168 for commit_hash in self["patch_commit_hashes"]: | 167 for commit_hash in self["patch_commit_hashes"]: |
| 169 print("Applying patch for %s to %s..." | 168 print("Applying patch for %s to %s..." |
| 170 % (commit_hash, self["merge_to_branch"])) | 169 % (commit_hash, self["merge_to_branch"])) |
| 171 patch = self.GitGetPatch(commit_hash) | 170 patch = self.GitGetPatch(commit_hash) |
| 172 TextToFile(patch, self.Config(TEMPORARY_PATCH_FILE)) | 171 TextToFile(patch, self.Config(TEMPORARY_PATCH_FILE)) |
| 173 self.ApplyPatch(self.Config(TEMPORARY_PATCH_FILE), self._options.revert) | 172 self.ApplyPatch(self.Config(TEMPORARY_PATCH_FILE), self._options.revert) |
| 174 if self._options.patch: | 173 if self._options.patch: |
| 175 self.ApplyPatch(self._options.patch, self._options.revert) | 174 self.ApplyPatch(self._options.patch, self._options.revert) |
| 176 | 175 |
| 177 | 176 |
| 178 class PrepareVersion(Step): | 177 class PrepareVersion(Step): |
| 179 MESSAGE = "Prepare version file." | 178 MESSAGE = "Prepare version file." |
| 180 | 179 |
| 181 def RunStep(self): | 180 def RunStep(self): |
| 182 if self._options.revert_bleeding_edge: | 181 if self._options.revert_bleeding_edge: |
| 183 return | 182 return |
| 184 # These version numbers are used again for creating the tag | 183 # This is used to calculate the patch level increment. |
| 185 self.ReadAndPersistVersion() | 184 self.ReadAndPersistVersion() |
| 186 | 185 |
| 187 | 186 |
| 188 class IncrementVersion(Step): | 187 class IncrementVersion(Step): |
| 189 MESSAGE = "Increment version number." | 188 MESSAGE = "Increment version number." |
| 190 | 189 |
| 191 def RunStep(self): | 190 def RunStep(self): |
| 192 if self._options.revert_bleeding_edge: | 191 if self._options.revert_bleeding_edge: |
| 193 return | 192 return |
| 194 new_patch = str(int(self["patch"]) + 1) | 193 new_patch = str(int(self["patch"]) + 1) |
| 195 if self.Confirm("Automatically increment PATCH_LEVEL? (Saying 'n' will " | 194 if self.Confirm("Automatically increment PATCH_LEVEL? (Saying 'n' will " |
| 196 "fire up your EDITOR on %s so you can make arbitrary " | 195 "fire up your EDITOR on %s so you can make arbitrary " |
| 197 "changes. When you're done, save the file and exit your " | 196 "changes. When you're done, save the file and exit your " |
| 198 "EDITOR.)" % self.Config(VERSION_FILE)): | 197 "EDITOR.)" % self.Config(VERSION_FILE)): |
| 199 text = FileToText(self.Config(VERSION_FILE)) | 198 text = FileToText(self.Config(VERSION_FILE)) |
| 200 text = MSub(r"(?<=#define PATCH_LEVEL)(?P<space>\s+)\d*$", | 199 text = MSub(r"(?<=#define PATCH_LEVEL)(?P<space>\s+)\d*$", |
| 201 r"\g<space>%s" % new_patch, | 200 r"\g<space>%s" % new_patch, |
| 202 text) | 201 text) |
| 203 TextToFile(text, self.Config(VERSION_FILE)) | 202 TextToFile(text, self.Config(VERSION_FILE)) |
| 204 else: | 203 else: |
| 205 self.Editor(self.Config(VERSION_FILE)) | 204 self.Editor(self.Config(VERSION_FILE)) |
| 206 self.ReadAndPersistVersion("new_") | 205 self.ReadAndPersistVersion("new_") |
| 206 self["version"] = "%s.%s.%s.%s" % (self["new_major"], |
| 207 self["new_minor"], |
| 208 self["new_build"], |
| 209 self["new_patch"]) |
| 207 | 210 |
| 208 | 211 |
| 209 class CommitLocal(Step): | 212 class CommitLocal(Step): |
| 210 MESSAGE = "Commit to local branch." | 213 MESSAGE = "Commit to local branch." |
| 211 | 214 |
| 212 def RunStep(self): | 215 def RunStep(self): |
| 216 if not self._options.revert_bleeding_edge: |
| 217 self["new_commit_msg"] = "Version %s\n\n%s" % (self["version"], |
| 218 self["new_commit_msg"]) |
| 219 TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE)) |
| 213 self.GitCommit(file_name=self.Config(COMMITMSG_FILE)) | 220 self.GitCommit(file_name=self.Config(COMMITMSG_FILE)) |
| 214 | 221 |
| 215 | 222 |
| 216 class CommitRepository(Step): | 223 class CommitRepository(Step): |
| 217 MESSAGE = "Commit to the repository." | 224 MESSAGE = "Commit to the repository." |
| 218 | 225 |
| 219 def RunStep(self): | 226 def RunStep(self): |
| 220 self.GitCheckout(self.Config(BRANCHNAME)) | 227 self.GitCheckout(self.Config(BRANCHNAME)) |
| 221 self.WaitForLGTM() | 228 self.WaitForLGTM() |
| 222 self.GitPresubmit() | 229 self.GitPresubmit() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 237 self["svn_revision"] = self.GitSVNFindSVNRev(commit_hash) | 244 self["svn_revision"] = self.GitSVNFindSVNRev(commit_hash) |
| 238 print "subversion revision number is r%s" % self["svn_revision"] | 245 print "subversion revision number is r%s" % self["svn_revision"] |
| 239 | 246 |
| 240 | 247 |
| 241 class TagRevision(Step): | 248 class TagRevision(Step): |
| 242 MESSAGE = "Create the tag." | 249 MESSAGE = "Create the tag." |
| 243 | 250 |
| 244 def RunStep(self): | 251 def RunStep(self): |
| 245 if self._options.revert_bleeding_edge: | 252 if self._options.revert_bleeding_edge: |
| 246 return | 253 return |
| 247 self["version"] = "%s.%s.%s.%s" % (self["new_major"], | |
| 248 self["new_minor"], | |
| 249 self["new_build"], | |
| 250 self["new_patch"]) | |
| 251 print "Creating tag svn/tags/%s" % self["version"] | 254 print "Creating tag svn/tags/%s" % self["version"] |
| 252 if self["merge_to_branch"] == "trunk": | 255 if self["merge_to_branch"] == "trunk": |
| 253 self["to_url"] = "trunk" | 256 self["to_url"] = "trunk" |
| 254 else: | 257 else: |
| 255 self["to_url"] = "branches/%s" % self["merge_to_branch"] | 258 self["to_url"] = "branches/%s" % self["merge_to_branch"] |
| 256 self.SVN("copy -r %s https://v8.googlecode.com/svn/%s " | 259 self.SVN("copy -r %s https://v8.googlecode.com/svn/%s " |
| 257 "https://v8.googlecode.com/svn/tags/%s -m " | 260 "https://v8.googlecode.com/svn/tags/%s -m " |
| 258 "\"Tagging version %s\"" | 261 "\"Tagging version %s\"" |
| 259 % (self["svn_revision"], self["to_url"], | 262 % (self["svn_revision"], self["to_url"], |
| 260 self["version"], self["version"])) | 263 self["version"], self["version"])) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 UploadStep, | 325 UploadStep, |
| 323 CommitRepository, | 326 CommitRepository, |
| 324 PrepareSVN, | 327 PrepareSVN, |
| 325 TagRevision, | 328 TagRevision, |
| 326 CleanUp, | 329 CleanUp, |
| 327 ] | 330 ] |
| 328 | 331 |
| 329 | 332 |
| 330 if __name__ == "__main__": # pragma: no cover | 333 if __name__ == "__main__": # pragma: no cover |
| 331 sys.exit(MergeToBranch(CONFIG).Run()) | 334 sys.exit(MergeToBranch(CONFIG).Run()) |
| OLD | NEW |