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 import argparse | 6 import argparse |
7 import sys | 7 import sys |
8 | 8 |
9 from common_includes import * | 9 from common_includes import * |
10 | 10 |
11 | 11 |
12 class Preparation(Step): | 12 class Preparation(Step): |
13 MESSAGE = "Preparation." | 13 MESSAGE = "Preparation." |
14 | 14 |
15 def RunStep(self): | 15 def RunStep(self): |
16 self.CommonPrepare() | 16 self.CommonPrepare() |
17 self.PrepareBranch() | 17 self.PrepareBranch() |
18 self.GitCheckout("master") | 18 self.GitCheckout("master") |
19 self.GitSVNRebase() | 19 self.vc.Pull() |
20 | 20 |
21 | 21 |
22 class GetTags(Step): | 22 class GetTags(Step): |
23 MESSAGE = "Get all V8 tags." | 23 MESSAGE = "Get all V8 tags." |
24 | 24 |
25 def RunStep(self): | 25 def RunStep(self): |
26 self.GitCreateBranch(self._config["BRANCHNAME"]) | 26 self.GitCreateBranch(self._config["BRANCHNAME"]) |
27 | 27 self["tags"] = self.vc.GetTags() |
28 # Get remote tags. | |
29 tags = filter(lambda s: re.match(r"^svn/tags/[\d+\.]+$", s), | |
30 self.GitRemotes()) | |
31 | |
32 # Remove 'svn/tags/' prefix. | |
33 self["tags"] = map(lambda s: s[9:], tags) | |
34 | 28 |
35 | 29 |
36 class GetOldestUntaggedVersion(Step): | 30 class GetOldestUntaggedVersion(Step): |
37 MESSAGE = "Check if there's a version on bleeding edge without a tag." | 31 MESSAGE = "Check if there's a version on bleeding edge without a tag." |
38 | 32 |
39 def RunStep(self): | 33 def RunStep(self): |
40 tags = set(self["tags"]) | 34 tags = set(self["tags"]) |
41 self["candidate"] = None | 35 self["candidate"] = None |
42 self["candidate_version"] = None | 36 self["candidate_version"] = None |
43 self["next"] = None | 37 self["next"] = None |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 (exclusive). | 101 (exclusive). |
108 """ | 102 """ |
109 for lkgr in self["lkgrs"]: | 103 for lkgr in self["lkgrs"]: |
110 # LKGRs are reverse sorted. | 104 # LKGRs are reverse sorted. |
111 if int(min_rev) <= int(lkgr) and int(lkgr) < int(max_rev): | 105 if int(min_rev) <= int(lkgr) and int(lkgr) < int(max_rev): |
112 return lkgr | 106 return lkgr |
113 return None | 107 return None |
114 | 108 |
115 def RunStep(self): | 109 def RunStep(self): |
116 # Get the lkgr after the tag candidate and before the next tag candidate. | 110 # Get the lkgr after the tag candidate and before the next tag candidate. |
117 candidate_svn = self.GitSVNFindSVNRev(self["candidate"]) | 111 candidate_svn = self.vc.GitSvn(self["candidate"]) |
118 if self["next"]: | 112 if self["next"]: |
119 next_svn = self.GitSVNFindSVNRev(self["next"]) | 113 next_svn = self.vc.GitSvn(self["next"]) |
120 else: | 114 else: |
121 # Don't include the version change commit itself if there is no upper | 115 # Don't include the version change commit itself if there is no upper |
122 # limit yet. | 116 # limit yet. |
123 candidate_svn = str(int(candidate_svn) + 1) | 117 candidate_svn = str(int(candidate_svn) + 1) |
124 next_svn = sys.maxint | 118 next_svn = sys.maxint |
125 lkgr_svn = self.LastLKGR(candidate_svn, next_svn) | 119 lkgr_svn = self.LastLKGR(candidate_svn, next_svn) |
126 | 120 |
127 if not lkgr_svn: | 121 if not lkgr_svn: |
128 print "There is no lkgr since the candidate version yet." | 122 print "There is no lkgr since the candidate version yet." |
129 self.CommonCleanup() | 123 self.CommonCleanup() |
130 return True | 124 return True |
131 | 125 |
132 # Let's check if the lkgr is at least three hours old. | 126 # Let's check if the lkgr is at least three hours old. |
133 self["lkgr"] = self.GitSVNFindGitHash(lkgr_svn) | 127 self["lkgr"] = self.vc.SvnGit(lkgr_svn) |
134 if not self["lkgr"]: | 128 if not self["lkgr"]: |
135 print "Couldn't find git hash for lkgr %s" % lkgr_svn | 129 print "Couldn't find git hash for lkgr %s" % lkgr_svn |
136 self.CommonCleanup() | 130 self.CommonCleanup() |
137 return True | 131 return True |
138 | 132 |
139 lkgr_utc_time = int(self.GitLog(n=1, format="%at", git_hash=self["lkgr"])) | 133 lkgr_utc_time = int(self.GitLog(n=1, format="%at", git_hash=self["lkgr"])) |
140 current_utc_time = self._side_effect_handler.GetUTCStamp() | 134 current_utc_time = self._side_effect_handler.GetUTCStamp() |
141 | 135 |
142 if current_utc_time < lkgr_utc_time + 10800: | 136 if current_utc_time < lkgr_utc_time + 10800: |
143 print "Candidate lkgr %s is too recent for tagging." % lkgr_svn | 137 print "Candidate lkgr %s is too recent for tagging." % lkgr_svn |
144 self.CommonCleanup() | 138 self.CommonCleanup() |
145 return True | 139 return True |
146 | 140 |
147 print "Tagging revision %s with %s" % (lkgr_svn, self["candidate_version"]) | 141 print "Tagging revision %s with %s" % (lkgr_svn, self["candidate_version"]) |
148 | 142 |
149 | 143 |
150 class MakeTag(Step): | 144 class MakeTag(Step): |
151 MESSAGE = "Tag the version." | 145 MESSAGE = "Tag the version." |
152 | 146 |
153 def RunStep(self): | 147 def RunStep(self): |
154 if not self._options.dry_run: | 148 if not self._options.dry_run: |
155 self.GitReset(self["lkgr"]) | 149 self.GitReset(self["lkgr"]) |
156 self.GitSVNTag(self["candidate_version"]) | 150 self.vc.Tag(self["candidate_version"]) |
157 | 151 |
158 | 152 |
159 class CleanUp(Step): | 153 class CleanUp(Step): |
160 MESSAGE = "Clean up." | 154 MESSAGE = "Clean up." |
161 | 155 |
162 def RunStep(self): | 156 def RunStep(self): |
163 self.CommonCleanup() | 157 self.CommonCleanup() |
164 | 158 |
165 | 159 |
166 class AutoTag(ScriptsBase): | 160 class AutoTag(ScriptsBase): |
(...skipping 23 matching lines...) Expand all Loading... |
190 GetOldestUntaggedVersion, | 184 GetOldestUntaggedVersion, |
191 GetLKGRs, | 185 GetLKGRs, |
192 CalculateTagRevision, | 186 CalculateTagRevision, |
193 MakeTag, | 187 MakeTag, |
194 CleanUp, | 188 CleanUp, |
195 ] | 189 ] |
196 | 190 |
197 | 191 |
198 if __name__ == "__main__": # pragma: no cover | 192 if __name__ == "__main__": # pragma: no cover |
199 sys.exit(AutoTag().Run()) | 193 sys.exit(AutoTag().Run()) |
OLD | NEW |