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

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

Issue 682863006: Make releases script more git friendly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONFIG = { 23 CONFIG = {
24 "BRANCHNAME": "retrieve-v8-releases", 24 "BRANCHNAME": "retrieve-v8-releases",
25 "PERSISTFILE_BASENAME": "/tmp/v8-releases-tempfile", 25 "PERSISTFILE_BASENAME": "/tmp/v8-releases-tempfile",
26 } 26 }
27 27
28 # Expression for retrieving the bleeding edge revision from a commit message. 28 # Expression for retrieving the bleeding edge revision from a commit message.
29 PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") 29 PUSH_MSG_SVN_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
30 PUSH_MSG_GIT_RE = re.compile(r".* \(based on ([a-fA-F0-9]+)\)$")
30 31
31 # Expression for retrieving the merged patches from a merge commit message 32 # Expression for retrieving the merged patches from a merge commit message
32 # (old and new format). 33 # (old and new format).
33 MERGE_MESSAGE_RE = re.compile(r"^.*[M|m]erged (.+)(\)| into).*$", re.M) 34 MERGE_MESSAGE_RE = re.compile(r"^.*[M|m]erged (.+)(\)| into).*$", re.M)
34 35
35 # Expression for retrieving reverted patches from a commit message (old and 36 # Expression for retrieving reverted patches from a commit message (old and
36 # new format). 37 # new format).
37 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M) 38 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M)
38 39
39 # Expression for retrieving the code review link. 40 # Expression for retrieving the code review link.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 123
123 class RetrieveV8Releases(Step): 124 class RetrieveV8Releases(Step):
124 MESSAGE = "Retrieve all V8 releases." 125 MESSAGE = "Retrieve all V8 releases."
125 126
126 def ExceedsMax(self, releases): 127 def ExceedsMax(self, releases):
127 return (self._options.max_releases > 0 128 return (self._options.max_releases > 0
128 and len(releases) > self._options.max_releases) 129 and len(releases) > self._options.max_releases)
129 130
130 def GetBleedingEdgeFromPush(self, title): 131 def GetBleedingEdgeFromPush(self, title):
131 return MatchSafe(PUSH_MESSAGE_RE.match(title)) 132 return MatchSafe(PUSH_MSG_SVN_RE.match(title))
133
134 def GetBleedingEdgeGitFromPush(self, title):
135 return MatchSafe(PUSH_MSG_GIT_RE.match(title))
132 136
133 def GetMergedPatches(self, body): 137 def GetMergedPatches(self, body):
134 patches = MatchSafe(MERGE_MESSAGE_RE.search(body)) 138 patches = MatchSafe(MERGE_MESSAGE_RE.search(body))
135 if not patches: 139 if not patches:
136 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body)) 140 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body))
137 if patches: 141 if patches:
138 # Indicate reverted patches with a "-". 142 # Indicate reverted patches with a "-".
139 patches = "-%s" % patches 143 patches = "-%s" % patches
140 return patches 144 return patches
141 145
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if self["patch"] != "0": 186 if self["patch"] != "0":
183 version += ".%s" % self["patch"] 187 version += ".%s" % self["patch"]
184 patches = self.GetMergedPatches(body) 188 patches = self.GetMergedPatches(body)
185 189
186 title = self.GitLog(n=1, format="%s", git_hash=git_hash) 190 title = self.GitLog(n=1, format="%s", git_hash=git_hash)
187 bleeding_edge_revision = self.GetBleedingEdgeFromPush(title) 191 bleeding_edge_revision = self.GetBleedingEdgeFromPush(title)
188 bleeding_edge_git = "" 192 bleeding_edge_git = ""
189 if bleeding_edge_revision: 193 if bleeding_edge_revision:
190 bleeding_edge_git = self.vc.SvnGit(bleeding_edge_revision, 194 bleeding_edge_git = self.vc.SvnGit(bleeding_edge_revision,
191 self.vc.RemoteMasterBranch()) 195 self.vc.RemoteMasterBranch())
196 else:
197 bleeding_edge_git = self.GetBleedingEdgeGitFromPush(title)
192 return self.GetReleaseDict( 198 return self.GetReleaseDict(
193 git_hash, bleeding_edge_revision, bleeding_edge_git, branch, version, 199 git_hash, bleeding_edge_revision, bleeding_edge_git, branch, version,
194 patches, body), self["patch"] 200 patches, body), self["patch"]
195 201
196 def GetReleasesFromMaster(self): 202 def GetReleasesFromMaster(self):
197 tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20") 203 tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20")
198 releases = [] 204 releases = []
199 for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text): 205 for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text):
200 git_hash = self.vc.SvnGit(revision) 206 git_hash = self.vc.SvnGit(revision)
201 207
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 UpdateChromiumCheckout, 476 UpdateChromiumCheckout,
471 RetrieveChromiumV8Releases, 477 RetrieveChromiumV8Releases,
472 RietrieveChromiumBranches, 478 RietrieveChromiumBranches,
473 CleanUp, 479 CleanUp,
474 WriteOutput, 480 WriteOutput,
475 ] 481 ]
476 482
477 483
478 if __name__ == "__main__": # pragma: no cover 484 if __name__ == "__main__": # pragma: no cover
479 sys.exit(Releases().Run()) 485 sys.exit(Releases().Run())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698