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

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

Issue 868473004: External name changes of release scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | tools/push-to-trunk/auto_roll.py » ('j') | tools/release/releases.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following
11 # disclaimer in the documentation and/or other materials provided
12 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 import argparse
30 import json
31 import os
32 import re
33 import sys
34 import urllib
35
36 from common_includes import *
37 import push_to_trunk
38
39 PUSH_MESSAGE_RE = re.compile(r".* \(based on ([a-fA-F0-9]+)\)$")
40
41 class Preparation(Step):
42 MESSAGE = "Preparation."
43
44 def RunStep(self):
45 self.InitialEnvironmentChecks(self.default_cwd)
46 self.CommonPrepare()
47
48
49 class FetchCandidate(Step):
50 MESSAGE = "Fetching V8 roll candidate ref."
51
52 def RunStep(self):
53 self.Git("fetch origin +refs/heads/candidate:refs/heads/candidate")
54 self["candidate"] = self.Git("show-ref -s refs/heads/candidate").strip()
55
56
57 class CheckLastPush(Step):
58 MESSAGE = "Checking last V8 push to candidates."
59
60 def RunStep(self):
61 last_push = self.FindLastCandidatesPush()
62
63 # Retrieve the master revision of the last push from the text in
64 # the push commit message.
65 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push)
66 candidate = PUSH_MESSAGE_RE.match(last_push_title).group(1)
67
68 if not candidate: # pragma: no cover
69 self.Die("Could not retrieve master revision for candidates push %s"
70 % last_push)
71
72 if self["candidate"] == candidate:
73 print "Already pushed current candidate %s" % candidate
74 return True
75
76
77 class PushToCandidates(Step):
78 MESSAGE = "Pushing to candidates if specified."
79
80 def RunStep(self):
81 print "Pushing candidate %s to candidates." % self["candidate"]
82
83 args = [
84 "--author", self._options.author,
85 "--reviewer", self._options.reviewer,
86 "--revision", self["candidate"],
87 "--force",
88 ]
89
90 if self._options.work_dir:
91 args.extend(["--work-dir", self._options.work_dir])
92
93 # TODO(machenbach): Update the script before calling it.
94 if self._options.push:
95 self._side_effect_handler.Call(
96 push_to_trunk.PushToCandidates().Run, args)
97
98
99 class AutoPush(ScriptsBase):
100 def _PrepareOptions(self, parser):
101 parser.add_argument("-p", "--push",
102 help="Push to candidates. Dry run if unspecified.",
103 default=False, action="store_true")
104
105 def _ProcessOptions(self, options):
106 if not options.author or not options.reviewer: # pragma: no cover
107 print "You need to specify author and reviewer."
108 return False
109 options.requires_editor = False
110 return True
111
112 def _Config(self):
113 return {
114 "PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile",
115 }
116
117 def _Steps(self):
118 return [
119 Preparation,
120 FetchCandidate,
121 CheckLastPush,
122 PushToCandidates,
123 ]
124
125
126 if __name__ == "__main__": # pragma: no cover
127 sys.exit(AutoPush().Run())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/auto_roll.py » ('j') | tools/release/releases.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698