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

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

Issue 716153002: Switch release scripts to pure git. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. 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
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
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 self.PrepareBranch() 129 self.PrepareBranch()
130 130
131 131
132 class RetrieveV8Releases(Step): 132 class RetrieveV8Releases(Step):
133 MESSAGE = "Retrieve all V8 releases." 133 MESSAGE = "Retrieve all V8 releases."
134 134
135 def ExceedsMax(self, releases): 135 def ExceedsMax(self, releases):
136 return (self._options.max_releases > 0 136 return (self._options.max_releases > 0
137 and len(releases) > self._options.max_releases) 137 and len(releases) > self._options.max_releases)
138 138
139 def GetBleedingEdgeFromPush(self, title):
140 return MatchSafe(PUSH_MSG_SVN_RE.match(title))
141
142 def GetBleedingEdgeGitFromPush(self, title): 139 def GetBleedingEdgeGitFromPush(self, title):
143 return MatchSafe(PUSH_MSG_GIT_RE.match(title)) 140 return MatchSafe(PUSH_MSG_GIT_RE.match(title))
144 141
145 def GetMergedPatches(self, body): 142 def GetMergedPatches(self, body):
146 patches = MatchSafe(MERGE_MESSAGE_RE.search(body)) 143 patches = MatchSafe(MERGE_MESSAGE_RE.search(body))
147 if not patches: 144 if not patches:
148 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body)) 145 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body))
149 if patches: 146 if patches:
150 # Indicate reverted patches with a "-". 147 # Indicate reverted patches with a "-".
151 patches = "-%s" % patches 148 patches = "-%s" % patches
152 return patches 149 return patches
153 150
154 def GetMergedPatchesGit(self, body): 151 def GetMergedPatchesGit(self, body):
155 patches = [] 152 patches = []
156 for line in body.splitlines(): 153 for line in body.splitlines():
157 patch = MatchSafe(MERGE_MESSAGE_GIT_RE.match(line)) 154 patch = MatchSafe(MERGE_MESSAGE_GIT_RE.match(line))
158 if patch: 155 if patch:
159 patches.append(patch) 156 patches.append(patch)
160 patch = MatchSafe(ROLLBACK_MESSAGE_GIT_RE.match(line)) 157 patch = MatchSafe(ROLLBACK_MESSAGE_GIT_RE.match(line))
161 if patch: 158 if patch:
162 patches.append("-%s" % patch) 159 patches.append("-%s" % patch)
163 return ", ".join(patches) 160 return ", ".join(patches)
164 161
165 162
166 def GetReleaseDict( 163 def GetReleaseDict(
167 self, git_hash, bleeding_edge_rev, bleeding_edge_git, branch, version, 164 self, git_hash, bleeding_edge_rev, bleeding_edge_git, branch, version,
168 patches, cl_body): 165 patches, cl_body):
169 revision = self.vc.GitSvn(git_hash) 166 revision = self.GetCommitPositionNumber(git_hash)
170 return { 167 return {
171 # The SVN revision on the branch. 168 # The cr commit position number on the branch.
172 "revision": revision, 169 "revision": revision,
173 # The git revision on the branch. 170 # The git revision on the branch.
174 "revision_git": git_hash, 171 "revision_git": git_hash,
175 # The SVN revision on bleeding edge (only for newer trunk pushes). 172 # The cr commit position number on master.
176 "bleeding_edge": bleeding_edge_rev, 173 "bleeding_edge": bleeding_edge_rev,
177 # The same for git. 174 # The same for git.
178 "bleeding_edge_git": bleeding_edge_git, 175 "bleeding_edge_git": bleeding_edge_git,
179 # The branch name. 176 # The branch name.
180 "branch": branch, 177 "branch": branch,
181 # The version for displaying in the form 3.26.3 or 3.26.3.12. 178 # The version for displaying in the form 3.26.3 or 3.26.3.12.
182 "version": version, 179 "version": version,
183 # The date of the commit. 180 # The date of the commit.
184 "date": self.GitLog(n=1, format="%ci", git_hash=git_hash), 181 "date": self.GitLog(n=1, format="%ci", git_hash=git_hash),
185 # Merged patches if available in the form 'r1234, r2345'. 182 # Merged patches if available in the form 'r1234, r2345'.
(...skipping 18 matching lines...) Expand all
204 201
205 patches = "" 202 patches = ""
206 if self["patch"] != "0": 203 if self["patch"] != "0":
207 version += ".%s" % self["patch"] 204 version += ".%s" % self["patch"]
208 if CHERRY_PICK_TITLE_GIT_RE.match(body.splitlines()[0]): 205 if CHERRY_PICK_TITLE_GIT_RE.match(body.splitlines()[0]):
209 patches = self.GetMergedPatchesGit(body) 206 patches = self.GetMergedPatchesGit(body)
210 else: 207 else:
211 patches = self.GetMergedPatches(body) 208 patches = self.GetMergedPatches(body)
212 209
213 title = self.GitLog(n=1, format="%s", git_hash=git_hash) 210 title = self.GitLog(n=1, format="%s", git_hash=git_hash)
214 bleeding_edge_revision = self.GetBleedingEdgeFromPush(title) 211 bleeding_edge_git = self.GetBleedingEdgeGitFromPush(title)
215 bleeding_edge_git = "" 212 bleeding_edge_position = ""
216 if bleeding_edge_revision: 213 if bleeding_edge_git:
217 bleeding_edge_git = self.vc.SvnGit(bleeding_edge_revision, 214 bleeding_edge_position = self.GetCommitPositionNumber(bleeding_edge_git)
218 self.vc.RemoteMasterBranch()) 215 # TODO(machenbach): Add the commit position number.
219 else:
220 bleeding_edge_git = self.GetBleedingEdgeGitFromPush(title)
221 return self.GetReleaseDict( 216 return self.GetReleaseDict(
222 git_hash, bleeding_edge_revision, bleeding_edge_git, branch, version, 217 git_hash, bleeding_edge_position, bleeding_edge_git, branch, version,
223 patches, body), self["patch"] 218 patches, body), self["patch"]
224 219
225 def GetReleasesFromMaster(self): 220 def GetReleasesFromMaster(self):
226 tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20") 221 # TODO(machenbach): Implement this in git as soon as we tag again on
227 releases = [] 222 # master.
228 for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text): 223 # tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v
229 git_hash = self.vc.SvnGit(revision) 224 # --limit 20")
225 # releases = []
226 # for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text):
227 # git_hash = self.vc.SvnGit(revision)
230 228
231 # Add bleeding edge release. It does not contain patches or a code 229 # Add bleeding edge release. It does not contain patches or a code
232 # review link, as tags are not uploaded. 230 # review link, as tags are not uploaded.
233 releases.append(self.GetReleaseDict( 231 # releases.append(self.GetReleaseDict(
234 git_hash, revision, git_hash, self.vc.MasterBranch(), tag, "", "")) 232 # git_hash, revision, git_hash, self.vc.MasterBranch(), tag, "", ""))
235 return releases 233 return []
236 234
237 def GetReleasesFromBranch(self, branch): 235 def GetReleasesFromBranch(self, branch):
238 self.GitReset(self.vc.RemoteBranch(branch)) 236 self.GitReset(self.vc.RemoteBranch(branch))
239 if branch == self.vc.MasterBranch(): 237 if branch == self.vc.MasterBranch():
240 return self.GetReleasesFromMaster() 238 return self.GetReleasesFromMaster()
241 239
242 releases = [] 240 releases = []
243 try: 241 try:
244 for git_hash in self.GitLog(format="%H").splitlines(): 242 for git_hash in self.GitLog(format="%H").splitlines():
245 if VERSION_FILE not in self.GitChangedFiles(git_hash): 243 if VERSION_FILE not in self.GitChangedFiles(git_hash):
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 UpdateChromiumCheckout, 497 UpdateChromiumCheckout,
500 RetrieveChromiumV8Releases, 498 RetrieveChromiumV8Releases,
501 RietrieveChromiumBranches, 499 RietrieveChromiumBranches,
502 CleanUp, 500 CleanUp,
503 WriteOutput, 501 WriteOutput,
504 ] 502 ]
505 503
506 504
507 if __name__ == "__main__": # pragma: no cover 505 if __name__ == "__main__": # pragma: no cover
508 sys.exit(Releases().Run()) 506 sys.exit(Releases().Run())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698