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

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

Issue 702843002: Make merge_to_branch more git-friendly. (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
« no previous file with comments | « tools/push-to-trunk/merge_to_branch.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 15 matching lines...) Expand all
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_MSG_SVN_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 PUSH_MSG_GIT_RE = re.compile(r".* \(based on ([a-fA-F0-9]+)\)$")
31 31
32 # Expression for retrieving the merged patches from a merge commit message 32 # Expression for retrieving the merged patches from a merge commit message
33 # (old and new format). 33 # (old and new format).
34 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)
35 35
36 CHERRY_PICK_TITLE_GIT_RE = re.compile(r"^.* \(cherry\-pick\)\.?$")
37
38 # New git message for cherry-picked CLs. One message per line.
39 MERGE_MESSAGE_GIT_RE = re.compile(r"^Merged ([a-fA-F0-9]+)\.?$")
40
36 # Expression for retrieving reverted patches from a commit message (old and 41 # Expression for retrieving reverted patches from a commit message (old and
37 # new format). 42 # new format).
38 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M) 43 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M)
39 44
45 # New git message for reverted CLs. One message per line.
46 ROLLBACK_MESSAGE_GIT_RE = re.compile(r"^Rollback of ([a-fA-F0-9]+)\.?$")
47
40 # Expression for retrieving the code review link. 48 # Expression for retrieving the code review link.
41 REVIEW_LINK_RE = re.compile(r"^Review URL: (.+)$", re.M) 49 REVIEW_LINK_RE = re.compile(r"^Review URL: (.+)$", re.M)
42 50
43 # Expression with three versions (historical) for extracting the v8 revision 51 # Expression with three versions (historical) for extracting the v8 revision
44 # from the chromium DEPS file. 52 # from the chromium DEPS file.
45 DEPS_RE = re.compile(r"""^\s*(?:["']v8_revision["']: ["']""" 53 DEPS_RE = re.compile(r"""^\s*(?:["']v8_revision["']: ["']"""
46 """|\(Var\("googlecode_url"\) % "v8"\) \+ "\/trunk@""" 54 """|\(Var\("googlecode_url"\) % "v8"\) \+ "\/trunk@"""
47 """|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)""" 55 """|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)"""
48 """([^"']+)["'].*$""", re.M) 56 """([^"']+)["'].*$""", re.M)
49 57
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 144
137 def GetMergedPatches(self, body): 145 def GetMergedPatches(self, body):
138 patches = MatchSafe(MERGE_MESSAGE_RE.search(body)) 146 patches = MatchSafe(MERGE_MESSAGE_RE.search(body))
139 if not patches: 147 if not patches:
140 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body)) 148 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body))
141 if patches: 149 if patches:
142 # Indicate reverted patches with a "-". 150 # Indicate reverted patches with a "-".
143 patches = "-%s" % patches 151 patches = "-%s" % patches
144 return patches 152 return patches
145 153
154 def GetMergedPatchesGit(self, body):
155 patches = []
156 for line in body.splitlines():
157 patch = MatchSafe(MERGE_MESSAGE_GIT_RE.match(line))
158 if patch:
159 patches.append(patch)
160 patch = MatchSafe(ROLLBACK_MESSAGE_GIT_RE.match(line))
161 if patch:
162 patches.append("-%s" % patch)
163 return ", ".join(patches)
164
165
146 def GetReleaseDict( 166 def GetReleaseDict(
147 self, git_hash, bleeding_edge_rev, bleeding_edge_git, branch, version, 167 self, git_hash, bleeding_edge_rev, bleeding_edge_git, branch, version,
148 patches, cl_body): 168 patches, cl_body):
149 revision = self.vc.GitSvn(git_hash) 169 revision = self.vc.GitSvn(git_hash)
150 return { 170 return {
151 # The SVN revision on the branch. 171 # The SVN revision on the branch.
152 "revision": revision, 172 "revision": revision,
153 # The git revision on the branch. 173 # The git revision on the branch.
154 "revision_git": git_hash, 174 "revision_git": git_hash,
155 # The SVN revision on bleeding edge (only for newer trunk pushes). 175 # The SVN revision on bleeding edge (only for newer trunk pushes).
(...skipping 22 matching lines...) Expand all
178 198
179 def GetRelease(self, git_hash, branch): 199 def GetRelease(self, git_hash, branch):
180 self.ReadAndPersistVersion() 200 self.ReadAndPersistVersion()
181 base_version = [self["major"], self["minor"], self["build"]] 201 base_version = [self["major"], self["minor"], self["build"]]
182 version = ".".join(base_version) 202 version = ".".join(base_version)
183 body = self.GitLog(n=1, format="%B", git_hash=git_hash) 203 body = self.GitLog(n=1, format="%B", git_hash=git_hash)
184 204
185 patches = "" 205 patches = ""
186 if self["patch"] != "0": 206 if self["patch"] != "0":
187 version += ".%s" % self["patch"] 207 version += ".%s" % self["patch"]
188 patches = self.GetMergedPatches(body) 208 if CHERRY_PICK_TITLE_GIT_RE.match(body.splitlines()[0]):
209 patches = self.GetMergedPatchesGit(body)
210 else:
211 patches = self.GetMergedPatches(body)
189 212
190 title = self.GitLog(n=1, format="%s", git_hash=git_hash) 213 title = self.GitLog(n=1, format="%s", git_hash=git_hash)
191 bleeding_edge_revision = self.GetBleedingEdgeFromPush(title) 214 bleeding_edge_revision = self.GetBleedingEdgeFromPush(title)
192 bleeding_edge_git = "" 215 bleeding_edge_git = ""
193 if bleeding_edge_revision: 216 if bleeding_edge_revision:
194 bleeding_edge_git = self.vc.SvnGit(bleeding_edge_revision, 217 bleeding_edge_git = self.vc.SvnGit(bleeding_edge_revision,
195 self.vc.RemoteMasterBranch()) 218 self.vc.RemoteMasterBranch())
196 else: 219 else:
197 bleeding_edge_git = self.GetBleedingEdgeGitFromPush(title) 220 bleeding_edge_git = self.GetBleedingEdgeGitFromPush(title)
198 return self.GetReleaseDict( 221 return self.GetReleaseDict(
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 UpdateChromiumCheckout, 499 UpdateChromiumCheckout,
477 RetrieveChromiumV8Releases, 500 RetrieveChromiumV8Releases,
478 RietrieveChromiumBranches, 501 RietrieveChromiumBranches,
479 CleanUp, 502 CleanUp,
480 WriteOutput, 503 WriteOutput,
481 ] 504 ]
482 505
483 506
484 if __name__ == "__main__": # pragma: no cover 507 if __name__ == "__main__": # pragma: no cover
485 sys.exit(Releases().Run()) 508 sys.exit(Releases().Run())
OLDNEW
« no previous file with comments | « tools/push-to-trunk/merge_to_branch.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698