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 # 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 patches = "" | 176 patches = "" |
177 if self["patch"] != "0": | 177 if self["patch"] != "0": |
178 version += ".%s" % self["patch"] | 178 version += ".%s" % self["patch"] |
179 patches = self.GetMergedPatches(body) | 179 patches = self.GetMergedPatches(body) |
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 GetReleasesFromMaster(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.vc.SvnGit(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, self.vc.MasterBranch(), tag, "", "")) |
196 return releases | 196 return releases |
197 | 197 |
198 def GetReleasesFromBranch(self, branch): | 198 def GetReleasesFromBranch(self, branch): |
199 self.GitReset(self.vc.RemoteBranch(branch)) | 199 self.GitReset(self.vc.RemoteBranch(branch)) |
200 # TODO(machenbach): Rename this when switching to the git mirror. | 200 if branch == self.vc.MasterBranch(): |
201 if branch == 'bleeding_edge': | 201 return self.GetReleasesFromMaster() |
202 return self.GetReleasesFromBleedingEdge() | |
203 | 202 |
204 releases = [] | 203 releases = [] |
205 try: | 204 try: |
206 for git_hash in self.GitLog(format="%H").splitlines(): | 205 for git_hash in self.GitLog(format="%H").splitlines(): |
207 if VERSION_FILE not in self.GitChangedFiles(git_hash): | 206 if VERSION_FILE not in self.GitChangedFiles(git_hash): |
208 continue | 207 continue |
209 if self.ExceedsMax(releases): | 208 if self.ExceedsMax(releases): |
210 break # pragma: no cover | 209 break # pragma: no cover |
211 if not self.GitCheckoutFileSafe(VERSION_FILE, git_hash): | 210 if not self.GitCheckoutFileSafe(VERSION_FILE, git_hash): |
212 break # pragma: no cover | 211 break # pragma: no cover |
213 | 212 |
214 release, patch_level = self.GetRelease(git_hash, branch) | 213 release, patch_level = self.GetRelease(git_hash, branch) |
215 releases.append(release) | 214 releases.append(release) |
216 | 215 |
217 # Follow branches only until their creation point. | 216 # Follow branches only until their creation point. |
218 # TODO(machenbach): This omits patches if the version file wasn't | 217 # TODO(machenbach): This omits patches if the version file wasn't |
219 # manipulated correctly. Find a better way to detect the point where | 218 # manipulated correctly. Find a better way to detect the point where |
220 # the parent of the branch head leads to the trunk branch. | 219 # the parent of the branch head leads to the trunk branch. |
221 if branch != "trunk" and patch_level == "0": | 220 if branch != self.vc.CandidateBranch() and patch_level == "0": |
222 break | 221 break |
223 | 222 |
224 # Allow Ctrl-C interrupt. | 223 # Allow Ctrl-C interrupt. |
225 except (KeyboardInterrupt, SystemExit): # pragma: no cover | 224 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
226 pass | 225 pass |
227 | 226 |
228 # Clean up checked-out version file. | 227 # Clean up checked-out version file. |
229 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD") | 228 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD") |
230 return releases | 229 return releases |
231 | 230 |
232 def RunStep(self): | 231 def RunStep(self): |
233 self.GitCreateBranch(self._config["BRANCHNAME"]) | 232 self.GitCreateBranch(self._config["BRANCHNAME"]) |
234 branches = self.vc.GetBranches() | 233 branches = self.vc.GetBranches() |
235 releases = [] | 234 releases = [] |
236 if self._options.branch == 'recent': | 235 if self._options.branch == 'recent': |
237 # Get only recent development on trunk, beta and stable. | 236 # Get only recent development on trunk, beta and stable. |
238 if self._options.max_releases == 0: # pragma: no cover | 237 if self._options.max_releases == 0: # pragma: no cover |
239 self._options.max_releases = 10 | 238 self._options.max_releases = 10 |
240 beta, stable = SortBranches(branches)[0:2] | 239 beta, stable = SortBranches(branches)[0:2] |
241 releases += self.GetReleasesFromBranch(stable) | 240 releases += self.GetReleasesFromBranch(stable) |
242 releases += self.GetReleasesFromBranch(beta) | 241 releases += self.GetReleasesFromBranch(beta) |
243 releases += self.GetReleasesFromBranch("trunk") | 242 releases += self.GetReleasesFromBranch(self.vc.CandidateBranch()) |
244 releases += self.GetReleasesFromBranch("bleeding_edge") | 243 releases += self.GetReleasesFromBranch(self.vc.MasterBranch()) |
245 elif self._options.branch == 'all': # pragma: no cover | 244 elif self._options.branch == 'all': # pragma: no cover |
246 # Retrieve the full release history. | 245 # Retrieve the full release history. |
247 for branch in branches: | 246 for branch in branches: |
248 releases += self.GetReleasesFromBranch(branch) | 247 releases += self.GetReleasesFromBranch(branch) |
249 releases += self.GetReleasesFromBranch("trunk") | 248 releases += self.GetReleasesFromBranch(self.vc.CandidateBranch()) |
250 releases += self.GetReleasesFromBranch("bleeding_edge") | 249 releases += self.GetReleasesFromBranch(self.vc.MasterBranch()) |
251 else: # pragma: no cover | 250 else: # pragma: no cover |
252 # Retrieve history for a specified branch. | 251 # Retrieve history for a specified branch. |
253 assert self._options.branch in branches + ["trunk", "bleeding_edge"] | 252 assert self._options.branch in (branches + |
| 253 [self.vc.CandidateBranch(), self.vc.MasterBranch()]) |
254 releases += self.GetReleasesFromBranch(self._options.branch) | 254 releases += self.GetReleasesFromBranch(self._options.branch) |
255 | 255 |
256 self["releases"] = sorted(releases, | 256 self["releases"] = sorted(releases, |
257 key=lambda r: SortingKey(r["version"]), | 257 key=lambda r: SortingKey(r["version"]), |
258 reverse=True) | 258 reverse=True) |
259 | 259 |
260 | 260 |
261 class SwitchChromium(Step): | 261 class SwitchChromium(Step): |
262 MESSAGE = "Switch to Chromium checkout." | 262 MESSAGE = "Switch to Chromium checkout." |
263 | 263 |
(...skipping 24 matching lines...) Expand all Loading... |
288 return step.GitConvertToSVNRevision( | 288 return step.GitConvertToSVNRevision( |
289 revision, cwd=os.path.join(step._options.chromium, "v8")) | 289 revision, cwd=os.path.join(step._options.chromium, "v8")) |
290 | 290 |
291 | 291 |
292 class RetrieveChromiumV8Releases(Step): | 292 class RetrieveChromiumV8Releases(Step): |
293 MESSAGE = "Retrieve V8 releases from Chromium DEPS." | 293 MESSAGE = "Retrieve V8 releases from Chromium DEPS." |
294 | 294 |
295 def RunStep(self): | 295 def RunStep(self): |
296 cwd = self._options.chromium | 296 cwd = self._options.chromium |
297 releases = filter( | 297 releases = filter( |
298 lambda r: r["branch"] in ["trunk", "bleeding_edge"], self["releases"]) | 298 lambda r: r["branch"] in [self.vc.CandidateBranch(), |
| 299 self.vc.MasterBranch()], |
| 300 self["releases"]) |
299 if not releases: # pragma: no cover | 301 if not releases: # pragma: no cover |
300 print "No releases detected. Skipping chromium history." | 302 print "No releases detected. Skipping chromium history." |
301 return True | 303 return True |
302 | 304 |
303 # Update v8 checkout in chromium. | 305 # Update v8 checkout in chromium. |
304 self.GitFetchOrigin(cwd=os.path.join(cwd, "v8")) | 306 self.GitFetchOrigin(cwd=os.path.join(cwd, "v8")) |
305 | 307 |
306 oldest_v8_rev = int(releases[-1]["revision"]) | 308 oldest_v8_rev = int(releases[-1]["revision"]) |
307 | 309 |
308 cr_releases = [] | 310 cr_releases = [] |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 for revision, ranges in all_ranges.iteritems(): | 342 for revision, ranges in all_ranges.iteritems(): |
341 releases_dict.get(revision, {})["chromium_revision"] = ranges | 343 releases_dict.get(revision, {})["chromium_revision"] = ranges |
342 | 344 |
343 | 345 |
344 # TODO(machenbach): Unify common code with method above. | 346 # TODO(machenbach): Unify common code with method above. |
345 class RietrieveChromiumBranches(Step): | 347 class RietrieveChromiumBranches(Step): |
346 MESSAGE = "Retrieve Chromium branch information." | 348 MESSAGE = "Retrieve Chromium branch information." |
347 | 349 |
348 def RunStep(self): | 350 def RunStep(self): |
349 cwd = self._options.chromium | 351 cwd = self._options.chromium |
350 trunk_releases = filter(lambda r: r["branch"] == "trunk", self["releases"]) | 352 trunk_releases = filter(lambda r: r["branch"] == self.vc.CandidateBranch(), |
| 353 self["releases"]) |
351 if not trunk_releases: # pragma: no cover | 354 if not trunk_releases: # pragma: no cover |
352 print "No trunk releases detected. Skipping chromium history." | 355 print "No trunk releases detected. Skipping chromium history." |
353 return True | 356 return True |
354 | 357 |
355 oldest_v8_rev = int(trunk_releases[-1]["revision"]) | 358 oldest_v8_rev = int(trunk_releases[-1]["revision"]) |
356 | 359 |
357 # Filter out irrelevant branches. | 360 # Filter out irrelevant branches. |
358 branches = filter(lambda r: re.match(r"branch-heads/\d+", r), | 361 branches = filter(lambda r: re.match(r"branch-heads/\d+", r), |
359 self.GitRemotes(cwd=cwd)) | 362 self.GitRemotes(cwd=cwd)) |
360 | 363 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 UpdateChromiumCheckout, | 460 UpdateChromiumCheckout, |
458 RetrieveChromiumV8Releases, | 461 RetrieveChromiumV8Releases, |
459 RietrieveChromiumBranches, | 462 RietrieveChromiumBranches, |
460 CleanUp, | 463 CleanUp, |
461 WriteOutput, | 464 WriteOutput, |
462 ] | 465 ] |
463 | 466 |
464 | 467 |
465 if __name__ == "__main__": # pragma: no cover | 468 if __name__ == "__main__": # pragma: no cover |
466 sys.exit(Releases().Run()) | 469 sys.exit(Releases().Run()) |
OLD | NEW |