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

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

Issue 607463002: Refactoring: Extract interface for VC in release scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 6 years, 2 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
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | 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
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 patches = MatchSafe(MERGE_MESSAGE_RE.search(body)) 134 patches = MatchSafe(MERGE_MESSAGE_RE.search(body))
135 if not patches: 135 if not patches:
136 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body)) 136 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body))
137 if patches: 137 if patches:
138 # Indicate reverted patches with a "-". 138 # Indicate reverted patches with a "-".
139 patches = "-%s" % patches 139 patches = "-%s" % patches
140 return patches 140 return patches
141 141
142 def GetReleaseDict( 142 def GetReleaseDict(
143 self, git_hash, bleeding_edge_rev, branch, version, patches, cl_body): 143 self, git_hash, bleeding_edge_rev, branch, version, patches, cl_body):
144 revision = self.GitSVNFindSVNRev(git_hash) 144 revision = self.vc.GitSvn(git_hash)
145 return { 145 return {
146 # The SVN revision on the branch. 146 # The SVN revision on the branch.
147 "revision": revision, 147 "revision": revision,
148 # The SVN revision on bleeding edge (only for newer trunk pushes). 148 # The SVN revision on bleeding edge (only for newer trunk pushes).
149 "bleeding_edge": bleeding_edge_rev, 149 "bleeding_edge": bleeding_edge_rev,
150 # The branch name. 150 # The branch name.
151 "branch": branch, 151 "branch": branch,
152 # The version for displaying in the form 3.26.3 or 3.26.3.12. 152 # The version for displaying in the form 3.26.3 or 3.26.3.12.
153 "version": version, 153 "version": version,
154 # The date of the commit. 154 # The date of the commit.
(...skipping 25 matching lines...) Expand all
180 180
181 title = self.GitLog(n=1, format="%s", git_hash=git_hash) 181 title = self.GitLog(n=1, format="%s", git_hash=git_hash)
182 return self.GetReleaseDict( 182 return self.GetReleaseDict(
183 git_hash, self.GetBleedingEdgeFromPush(title), branch, version, 183 git_hash, self.GetBleedingEdgeFromPush(title), branch, version,
184 patches, body), self["patch"] 184 patches, body), self["patch"]
185 185
186 def GetReleasesFromBleedingEdge(self): 186 def GetReleasesFromBleedingEdge(self):
187 tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20") 187 tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20")
188 releases = [] 188 releases = []
189 for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text): 189 for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text):
190 git_hash = self.GitSVNFindGitHash(revision) 190 git_hash = self.vc.SvnGit(revision)
191 191
192 # Add bleeding edge release. It does not contain patches or a code 192 # Add bleeding edge release. It does not contain patches or a code
193 # review link, as tags are not uploaded. 193 # review link, as tags are not uploaded.
194 releases.append(self.GetReleaseDict( 194 releases.append(self.GetReleaseDict(
195 git_hash, revision, "bleeding_edge", tag, "", "")) 195 git_hash, revision, "bleeding_edge", tag, "", ""))
196 return releases 196 return releases
197 197
198 def GetReleasesFromBranch(self, branch): 198 def GetReleasesFromBranch(self, branch):
199 self.GitReset("svn/%s" % branch) 199 self.GitReset(self.vc.RemoteBranch(branch))
200 # TODO(machenbach): Rename this when switching to the git mirror.
200 if branch == 'bleeding_edge': 201 if branch == 'bleeding_edge':
201 return self.GetReleasesFromBleedingEdge() 202 return self.GetReleasesFromBleedingEdge()
202 203
203 releases = [] 204 releases = []
204 try: 205 try:
205 for git_hash in self.GitLog(format="%H").splitlines(): 206 for git_hash in self.GitLog(format="%H").splitlines():
206 if VERSION_FILE not in self.GitChangedFiles(git_hash): 207 if VERSION_FILE not in self.GitChangedFiles(git_hash):
207 continue 208 continue
208 if self.ExceedsMax(releases): 209 if self.ExceedsMax(releases):
209 break # pragma: no cover 210 break # pragma: no cover
(...skipping 13 matching lines...) Expand all
223 # Allow Ctrl-C interrupt. 224 # Allow Ctrl-C interrupt.
224 except (KeyboardInterrupt, SystemExit): # pragma: no cover 225 except (KeyboardInterrupt, SystemExit): # pragma: no cover
225 pass 226 pass
226 227
227 # Clean up checked-out version file. 228 # Clean up checked-out version file.
228 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD") 229 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD")
229 return releases 230 return releases
230 231
231 def RunStep(self): 232 def RunStep(self):
232 self.GitCreateBranch(self._config["BRANCHNAME"]) 233 self.GitCreateBranch(self._config["BRANCHNAME"])
233 # Get relevant remote branches, e.g. "svn/3.25". 234 branches = self.vc.GetBranches()
234 branches = filter(lambda s: re.match(r"^svn/\d+\.\d+$", s),
235 self.GitRemotes())
236 # Remove 'svn/' prefix.
237 branches = map(lambda s: s[4:], branches)
238
239 releases = [] 235 releases = []
240 if self._options.branch == 'recent': 236 if self._options.branch == 'recent':
241 # Get only recent development on trunk, beta and stable. 237 # Get only recent development on trunk, beta and stable.
242 if self._options.max_releases == 0: # pragma: no cover 238 if self._options.max_releases == 0: # pragma: no cover
243 self._options.max_releases = 10 239 self._options.max_releases = 10
244 beta, stable = SortBranches(branches)[0:2] 240 beta, stable = SortBranches(branches)[0:2]
245 releases += self.GetReleasesFromBranch(stable) 241 releases += self.GetReleasesFromBranch(stable)
246 releases += self.GetReleasesFromBranch(beta) 242 releases += self.GetReleasesFromBranch(beta)
247 releases += self.GetReleasesFromBranch("trunk") 243 releases += self.GetReleasesFromBranch("trunk")
248 releases += self.GetReleasesFromBranch("bleeding_edge") 244 releases += self.GetReleasesFromBranch("bleeding_edge")
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 UpdateChromiumCheckout, 457 UpdateChromiumCheckout,
462 RetrieveChromiumV8Releases, 458 RetrieveChromiumV8Releases,
463 RietrieveChromiumBranches, 459 RietrieveChromiumBranches,
464 CleanUp, 460 CleanUp,
465 WriteOutput, 461 WriteOutput,
466 ] 462 ]
467 463
468 464
469 if __name__ == "__main__": # pragma: no cover 465 if __name__ == "__main__": # pragma: no cover
470 sys.exit(Releases().Run()) 466 sys.exit(Releases().Run())
OLDNEW
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698