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 |
15 class Preparation(Step): | 15 class Preparation(Step): |
16 MESSAGE = "Preparation." | 16 MESSAGE = "Preparation." |
17 | 17 |
18 def RunStep(self): | 18 def RunStep(self): |
19 self.Git("fetch origin +refs/heads/*:refs/heads/*") | 19 fetchspecs = [ |
20 self.Git("fetch origin +refs/branch-heads/*:refs/branch-heads/*") | 20 "+refs/heads/*:refs/heads/*", |
21 self.Git("fetch origin +refs/pending/*:refs/pending/*") | 21 "+refs/pending/*:refs/pending/*", |
22 self.Git("fetch origin +refs/pending-tags/*:refs/pending-tags/*") | 22 "+refs/pending-tags/*:refs/pending-tags/*", |
| 23 ] |
| 24 self.Git("fetch origin %s" % " ".join(fetchspecs)) |
23 self.GitCheckout("origin/master") | 25 self.GitCheckout("origin/master") |
24 self.DeleteBranch("work-branch") | 26 self.DeleteBranch("work-branch") |
25 | 27 |
26 | 28 |
27 class PrepareBranchRevision(Step): | 29 class PrepareBranchRevision(Step): |
28 MESSAGE = "Check from which revision to branch off." | 30 MESSAGE = "Check from which revision to branch off." |
29 | 31 |
30 def RunStep(self): | 32 def RunStep(self): |
31 if self._options.revision: | 33 if self._options.revision: |
32 self["push_hash"], tree_object = self.GitLog( | 34 self["push_hash"], tree_object = self.GitLog( |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) | 221 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) |
220 os.remove(self.Config("COMMITMSG_FILE")) | 222 os.remove(self.Config("COMMITMSG_FILE")) |
221 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) | 223 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) |
222 | 224 |
223 | 225 |
224 class PushBranch(Step): | 226 class PushBranch(Step): |
225 MESSAGE = "Push changes." | 227 MESSAGE = "Push changes." |
226 | 228 |
227 def RunStep(self): | 229 def RunStep(self): |
228 pushspecs = [ | 230 pushspecs = [ |
229 "refs/heads/work-branch:refs/pending/branch-heads/%s" % self["version"], | 231 "refs/heads/work-branch:refs/pending/heads/%s" % self["version"], |
230 "%s:refs/pending-tags/branch-heads/%s" % | 232 "%s:refs/pending-tags/heads/%s" % |
231 (self["pending_hash"], self["version"]), | 233 (self["pending_hash"], self["version"]), |
232 "%s:refs/branch-heads/%s" % (self["push_hash"], self["version"]), | 234 "%s:refs/heads/%s" % (self["push_hash"], self["version"]), |
233 ] | 235 ] |
234 cmd = "push origin %s" % " ".join(pushspecs) | 236 cmd = "push origin %s" % " ".join(pushspecs) |
235 if self._options.dry_run: | 237 if self._options.dry_run: |
236 print "Dry run. Command:\ngit %s" % cmd | 238 print "Dry run. Command:\ngit %s" % cmd |
237 else: | 239 else: |
238 self.Git(cmd) | 240 self.Git(cmd) |
239 | 241 |
240 | 242 |
241 class TagRevision(Step): | 243 class TagRevision(Step): |
242 MESSAGE = "Tag the new revision." | 244 MESSAGE = "Tag the new revision." |
243 | 245 |
244 def RunStep(self): | 246 def RunStep(self): |
245 if self._options.dry_run: | 247 if self._options.dry_run: |
246 print ("Dry run. Tagging \"%s\" with %s" % | 248 print ("Dry run. Tagging \"%s\" with %s" % |
247 (self["commit_title"], self["version"])) | 249 (self["commit_title"], self["version"])) |
248 else: | 250 else: |
249 self.vc.Tag(self["version"], | 251 self.vc.Tag(self["version"], |
250 "branch-heads/%s" % self["version"], | 252 "origin/%s" % self["version"], |
251 self["commit_title"]) | 253 self["commit_title"]) |
252 | 254 |
253 | 255 |
254 class CleanUp(Step): | 256 class CleanUp(Step): |
255 MESSAGE = "Done!" | 257 MESSAGE = "Done!" |
256 | 258 |
257 def RunStep(self): | 259 def RunStep(self): |
258 print("Congratulations, you have successfully created version %s." | 260 print("Congratulations, you have successfully created version %s." |
259 % self["version"]) | 261 % self["version"]) |
260 | 262 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 SetVersion, | 304 SetVersion, |
303 CommitBranch, | 305 CommitBranch, |
304 PushBranch, | 306 PushBranch, |
305 TagRevision, | 307 TagRevision, |
306 CleanUp, | 308 CleanUp, |
307 ] | 309 ] |
308 | 310 |
309 | 311 |
310 if __name__ == "__main__": # pragma: no cover | 312 if __name__ == "__main__": # pragma: no cover |
311 sys.exit(CreateRelease().Run()) | 313 sys.exit(CreateRelease().Run()) |
OLD | NEW |