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 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if not text: # pragma: no cover | 216 if not text: # pragma: no cover |
217 self.Die("Commit message editing failed.") | 217 self.Die("Commit message editing failed.") |
218 self["commit_title"] = text.splitlines()[0] | 218 self["commit_title"] = text.splitlines()[0] |
219 TextToFile(text, self.Config("COMMITMSG_FILE")) | 219 TextToFile(text, self.Config("COMMITMSG_FILE")) |
220 | 220 |
221 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) | 221 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) |
222 os.remove(self.Config("COMMITMSG_FILE")) | 222 os.remove(self.Config("COMMITMSG_FILE")) |
223 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) | 223 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) |
224 | 224 |
225 | 225 |
| 226 class FixBrokenTag(Step): |
| 227 MESSAGE = "Check for a missing tag and fix that instead." |
| 228 |
| 229 def RunStep(self): |
| 230 commit = None |
| 231 try: |
| 232 commit = self.GitLog( |
| 233 n=1, format="%H", |
| 234 grep=self["commit_title"], |
| 235 branch="origin/%s" % self["version"], |
| 236 ) |
| 237 except GitFailedException: |
| 238 # In the normal case, the remote doesn't exist yet and git will fail. |
| 239 pass |
| 240 if commit: |
| 241 print "Found %s. Trying to repair tag and bail out." % self["version"] |
| 242 self.step.Git("tag %s %s" % (self["version"], commit)) |
| 243 self.step.Git("push origin %s" % self["version"]) |
| 244 return True |
| 245 |
| 246 |
226 class PushBranch(Step): | 247 class PushBranch(Step): |
227 MESSAGE = "Push changes." | 248 MESSAGE = "Push changes." |
228 | 249 |
229 def RunStep(self): | 250 def RunStep(self): |
230 pushspecs = [ | 251 pushspecs = [ |
231 "refs/heads/work-branch:refs/pending/heads/%s" % self["version"], | 252 "refs/heads/work-branch:refs/pending/heads/%s" % self["version"], |
232 "%s:refs/pending-tags/heads/%s" % (self["push_hash"], self["version"]), | 253 "%s:refs/pending-tags/heads/%s" % (self["push_hash"], self["version"]), |
233 "%s:refs/heads/%s" % (self["push_hash"], self["version"]), | 254 "%s:refs/heads/%s" % (self["push_hash"], self["version"]), |
234 ] | 255 ] |
235 cmd = "push origin %s" % " ".join(pushspecs) | 256 cmd = "push origin %s" % " ".join(pushspecs) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 PrepareBranchRevision, | 317 PrepareBranchRevision, |
297 IncrementVersion, | 318 IncrementVersion, |
298 DetectLastRelease, | 319 DetectLastRelease, |
299 PrepareChangeLog, | 320 PrepareChangeLog, |
300 EditChangeLog, | 321 EditChangeLog, |
301 MakeBranch, | 322 MakeBranch, |
302 AddChangeLog, | 323 AddChangeLog, |
303 SetVersion, | 324 SetVersion, |
304 EnableMergeWatchlist, | 325 EnableMergeWatchlist, |
305 CommitBranch, | 326 CommitBranch, |
| 327 FixBrokenTag, |
306 PushBranch, | 328 PushBranch, |
307 TagRevision, | 329 TagRevision, |
308 CleanUp, | 330 CleanUp, |
309 ] | 331 ] |
310 | 332 |
311 | 333 |
312 if __name__ == "__main__": # pragma: no cover | 334 if __name__ == "__main__": # pragma: no cover |
313 sys.exit(CreateRelease().Run()) | 335 sys.exit(CreateRelease().Run()) |
OLD | NEW |