OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 the V8 project authors. All rights reserved. | 2 # Copyright 2015 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 import argparse | 6 import argparse |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 import tempfile | 9 import tempfile |
10 import urllib2 | 10 import urllib2 |
11 | 11 |
12 from common_includes import * | 12 from common_includes import * |
13 | 13 |
| 14 |
14 class Preparation(Step): | 15 class Preparation(Step): |
15 MESSAGE = "Preparation." | 16 MESSAGE = "Preparation." |
16 | 17 |
17 def RunStep(self): | 18 def RunStep(self): |
18 fetchspecs = [ | 19 fetchspecs = [ |
19 "+refs/heads/*:refs/heads/*", | 20 "+refs/heads/*:refs/heads/*", |
20 "+refs/pending/*:refs/pending/*", | 21 "+refs/pending/*:refs/pending/*", |
21 "+refs/pending-tags/*:refs/pending-tags/*", | 22 "+refs/pending-tags/*:refs/pending-tags/*", |
22 ] | 23 ] |
23 self.Git("fetch origin %s" % " ".join(fetchspecs)) | 24 self.Git("fetch origin %s" % " ".join(fetchspecs)) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 | 158 |
158 class MakeBranch(Step): | 159 class MakeBranch(Step): |
159 MESSAGE = "Create the branch." | 160 MESSAGE = "Create the branch." |
160 | 161 |
161 def RunStep(self): | 162 def RunStep(self): |
162 self.Git("reset --hard origin/master") | 163 self.Git("reset --hard origin/master") |
163 self.Git("checkout -b work-branch %s" % self["push_hash"]) | 164 self.Git("checkout -b work-branch %s" % self["push_hash"]) |
164 self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"]) | 165 self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"]) |
165 self.GitCheckoutFile(VERSION_FILE, self["latest_version"]) | 166 self.GitCheckoutFile(VERSION_FILE, self["latest_version"]) |
166 self.GitCheckoutFile(WATCHLISTS_FILE, self["latest_version"]) | |
167 | 167 |
168 | 168 |
169 class AddChangeLog(Step): | 169 class AddChangeLog(Step): |
170 MESSAGE = "Add ChangeLog changes to release branch." | 170 MESSAGE = "Add ChangeLog changes to release branch." |
171 | 171 |
172 def RunStep(self): | 172 def RunStep(self): |
173 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) | 173 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) |
174 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) | 174 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) |
175 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) | 175 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) |
176 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) | 176 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) |
177 | 177 |
178 | 178 |
179 class SetVersion(Step): | 179 class SetVersion(Step): |
180 MESSAGE = "Set correct version for candidates." | 180 MESSAGE = "Set correct version for candidates." |
181 | 181 |
182 def RunStep(self): | 182 def RunStep(self): |
183 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") | 183 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") |
184 | 184 |
185 | 185 |
186 class EnableMergeWatchlist(Step): | |
187 MESSAGE = "Enable watchlist entry for merge notifications." | |
188 | |
189 def RunStep(self): | |
190 old_watchlist_content = FileToText(os.path.join(self.default_cwd, | |
191 WATCHLISTS_FILE)) | |
192 new_watchlist_content = re.sub("(# 'v8-merges@googlegroups\.com',)", | |
193 "'v8-merges@googlegroups.com',", | |
194 old_watchlist_content) | |
195 TextToFile(new_watchlist_content, os.path.join(self.default_cwd, | |
196 WATCHLISTS_FILE)) | |
197 | |
198 | |
199 class CommitBranch(Step): | 186 class CommitBranch(Step): |
200 MESSAGE = "Commit version and changelog to new branch." | 187 MESSAGE = "Commit version and changelog to new branch." |
201 | 188 |
202 def RunStep(self): | 189 def RunStep(self): |
203 # Convert the ChangeLog entry to commit message format. | 190 # Convert the ChangeLog entry to commit message format. |
204 text = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) | 191 text = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) |
205 | 192 |
206 # Remove date and trailing white space. | 193 # Remove date and trailing white space. |
207 text = re.sub(r"^%s: " % self["date"], "", text.rstrip()) | 194 text = re.sub(r"^%s: " % self["date"], "", text.rstrip()) |
208 | 195 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return [ | 281 return [ |
295 Preparation, | 282 Preparation, |
296 PrepareBranchRevision, | 283 PrepareBranchRevision, |
297 IncrementVersion, | 284 IncrementVersion, |
298 DetectLastRelease, | 285 DetectLastRelease, |
299 PrepareChangeLog, | 286 PrepareChangeLog, |
300 EditChangeLog, | 287 EditChangeLog, |
301 MakeBranch, | 288 MakeBranch, |
302 AddChangeLog, | 289 AddChangeLog, |
303 SetVersion, | 290 SetVersion, |
304 EnableMergeWatchlist, | |
305 CommitBranch, | 291 CommitBranch, |
306 PushBranch, | 292 PushBranch, |
307 TagRevision, | 293 TagRevision, |
308 CleanUp, | 294 CleanUp, |
309 ] | 295 ] |
310 | 296 |
311 | 297 |
312 if __name__ == "__main__": # pragma: no cover | 298 if __name__ == "__main__": # pragma: no cover |
313 sys.exit(CreateRelease().Run()) | 299 sys.exit(CreateRelease().Run()) |
OLD | NEW |