Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: tools/push-to-trunk/releases.py

Issue 591783003: Refactoring: Remove more legacy from release scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Read version file relative to cwd. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This script retrieves the history of all V8 branches and trunk revisions and 6 # This script retrieves the history of all V8 branches and trunk revisions and
7 # their corresponding Chromium revisions. 7 # their corresponding Chromium revisions.
8 8
9 # Requires a chromium checkout with branch heads: 9 # Requires a chromium checkout with branch heads:
10 # gclient sync --with_branch_heads 10 # gclient sync --with_branch_heads
11 # gclient fetch 11 # gclient fetch
12 12
13 import argparse 13 import argparse
14 import csv 14 import csv
15 import itertools 15 import itertools
16 import json 16 import json
17 import os 17 import os
18 import re 18 import re
19 import sys 19 import sys
20 20
21 from common_includes import * 21 from common_includes import *
22 22
23 CHROMIUM = "CHROMIUM" 23 CHROMIUM = "CHROMIUM"
24 24
25 CONFIG = { 25 CONFIG = {
26 BRANCHNAME: "retrieve-v8-releases", 26 BRANCHNAME: "retrieve-v8-releases",
27 PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile", 27 PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile",
28 VERSION_FILE: "src/version.cc",
29 } 28 }
30 29
31 # Expression for retrieving the bleeding edge revision from a commit message. 30 # Expression for retrieving the bleeding edge revision from a commit message.
32 PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") 31 PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
33 32
34 # Expression for retrieving the merged patches from a merge commit message 33 # Expression for retrieving the merged patches from a merge commit message
35 # (old and new format). 34 # (old and new format).
36 MERGE_MESSAGE_RE = re.compile(r"^.*[M|m]erged (.+)(\)| into).*$", re.M) 35 MERGE_MESSAGE_RE = re.compile(r"^.*[M|m]erged (.+)(\)| into).*$", re.M)
37 36
38 # Expression for retrieving reverted patches from a commit message (old and 37 # Expression for retrieving reverted patches from a commit message (old and
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return releases 198 return releases
200 199
201 def GetReleasesFromBranch(self, branch): 200 def GetReleasesFromBranch(self, branch):
202 self.GitReset("svn/%s" % branch) 201 self.GitReset("svn/%s" % branch)
203 if branch == 'bleeding_edge': 202 if branch == 'bleeding_edge':
204 return self.GetReleasesFromBleedingEdge() 203 return self.GetReleasesFromBleedingEdge()
205 204
206 releases = [] 205 releases = []
207 try: 206 try:
208 for git_hash in self.GitLog(format="%H").splitlines(): 207 for git_hash in self.GitLog(format="%H").splitlines():
209 if self._config[VERSION_FILE] not in self.GitChangedFiles(git_hash): 208 if VERSION_FILE not in self.GitChangedFiles(git_hash):
210 continue 209 continue
211 if self.ExceedsMax(releases): 210 if self.ExceedsMax(releases):
212 break # pragma: no cover 211 break # pragma: no cover
213 if not self.GitCheckoutFileSafe(self._config[VERSION_FILE], git_hash): 212 if not self.GitCheckoutFileSafe(VERSION_FILE, git_hash):
214 break # pragma: no cover 213 break # pragma: no cover
215 214
216 release, patch_level = self.GetRelease(git_hash, branch) 215 release, patch_level = self.GetRelease(git_hash, branch)
217 releases.append(release) 216 releases.append(release)
218 217
219 # Follow branches only until their creation point. 218 # Follow branches only until their creation point.
220 # TODO(machenbach): This omits patches if the version file wasn't 219 # TODO(machenbach): This omits patches if the version file wasn't
221 # manipulated correctly. Find a better way to detect the point where 220 # manipulated correctly. Find a better way to detect the point where
222 # the parent of the branch head leads to the trunk branch. 221 # the parent of the branch head leads to the trunk branch.
223 if branch != "trunk" and patch_level == "0": 222 if branch != "trunk" and patch_level == "0":
224 break 223 break
225 224
226 # Allow Ctrl-C interrupt. 225 # Allow Ctrl-C interrupt.
227 except (KeyboardInterrupt, SystemExit): # pragma: no cover 226 except (KeyboardInterrupt, SystemExit): # pragma: no cover
228 pass 227 pass
229 228
230 # Clean up checked-out version file. 229 # Clean up checked-out version file.
231 self.GitCheckoutFileSafe(self._config[VERSION_FILE], "HEAD") 230 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD")
232 return releases 231 return releases
233 232
234 def RunStep(self): 233 def RunStep(self):
235 self.GitCreateBranch(self._config[BRANCHNAME]) 234 self.GitCreateBranch(self._config[BRANCHNAME])
236 # Get relevant remote branches, e.g. "svn/3.25". 235 # Get relevant remote branches, e.g. "svn/3.25".
237 branches = filter(lambda s: re.match(r"^svn/\d+\.\d+$", s), 236 branches = filter(lambda s: re.match(r"^svn/\d+\.\d+$", s),
238 self.GitRemotes()) 237 self.GitRemotes())
239 # Remove 'svn/' prefix. 238 # Remove 'svn/' prefix.
240 branches = map(lambda s: s[4:], branches) 239 branches = map(lambda s: s[4:], branches)
241 240
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 UpdateChromiumCheckout, 457 UpdateChromiumCheckout,
459 RetrieveChromiumV8Releases, 458 RetrieveChromiumV8Releases,
460 RietrieveChromiumBranches, 459 RietrieveChromiumBranches,
461 CleanUp, 460 CleanUp,
462 WriteOutput, 461 WriteOutput,
463 ] 462 ]
464 463
465 464
466 if __name__ == "__main__": # pragma: no cover 465 if __name__ == "__main__": # pragma: no cover
467 sys.exit(Releases(CONFIG).Run()) 466 sys.exit(Releases(CONFIG).Run())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698