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

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

Issue 698513002: Switch auto push script to git. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 18 matching lines...) Expand all
29 import argparse 29 import argparse
30 import json 30 import json
31 import os 31 import os
32 import re 32 import re
33 import sys 33 import sys
34 import urllib 34 import urllib
35 35
36 from common_includes import * 36 from common_includes import *
37 import push_to_trunk 37 import push_to_trunk
38 38
39 PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") 39 PUSH_MESSAGE_RE = re.compile(r".* \(based on ([a-fA-F0-9]+)\)$")
40 40
41 class Preparation(Step): 41 class Preparation(Step):
42 MESSAGE = "Preparation." 42 MESSAGE = "Preparation."
43 43
44 def RunStep(self): 44 def RunStep(self):
45 self.InitialEnvironmentChecks(self.default_cwd) 45 self.InitialEnvironmentChecks(self.default_cwd)
46 self.CommonPrepare() 46 self.CommonPrepare()
47 47
48 48
49 class CheckAutoPushSettings(Step): 49 class CheckAutoPushSettings(Step):
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 # Retrieve the bleeding edge revision of the last push from the text in 88 # Retrieve the bleeding edge revision of the last push from the text in
89 # the push commit message. 89 # the push commit message.
90 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) 90 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push)
91 last_push_be = PUSH_MESSAGE_RE.match(last_push_title).group(1) 91 last_push_be = PUSH_MESSAGE_RE.match(last_push_title).group(1)
92 92
93 if not last_push_be: # pragma: no cover 93 if not last_push_be: # pragma: no cover
94 self.Die("Could not retrieve bleeding edge revision for trunk push %s" 94 self.Die("Could not retrieve bleeding edge revision for trunk push %s"
95 % last_push) 95 % last_push)
96 96
97 # TODO(machenbach): This metric counts all revisions. It could be 97 if self["lkgr"] == last_push_be:
98 # improved by counting only the revisions on bleeding_edge. 98 print "Already pushed current lkgr %s" % last_push_be
99 if int(self["lkgr"]) - int(last_push_be) < 10: # pragma: no cover 99 return True
100 # This makes sure the script doesn't push twice in a row when the cron
101 # job retries several times.
102 self.Die("Last push too recently: %s" % last_push_be)
103 100
104 101
105 class PushToTrunk(Step): 102 class PushToCandidates(Step):
106 MESSAGE = "Pushing to trunk if specified." 103 MESSAGE = "Pushing to candidates if specified."
107 104
108 def RunStep(self): 105 def RunStep(self):
109 print "Pushing lkgr %s to trunk." % self["lkgr"] 106 print "Pushing lkgr %s to candidates." % self["lkgr"]
110 107
111 # TODO(machenbach): Update the script before calling it. 108 # TODO(machenbach): Update the script before calling it.
112 if self._options.push: 109 if self._options.push:
113 self._side_effect_handler.Call( 110 self._side_effect_handler.Call(
114 push_to_trunk.PushToTrunk().Run, 111 push_to_trunk.PushToTrunk().Run,
115 ["--author", self._options.author, 112 ["--author", self._options.author,
116 "--reviewer", self._options.reviewer, 113 "--reviewer", self._options.reviewer,
117 "--revision", self["lkgr"], 114 "--revision", self["lkgr"],
118 "--force"]) 115 "--force"])
119 116
(...skipping 17 matching lines...) Expand all
137 "SETTINGS_LOCATION": "~/.auto-roll", 134 "SETTINGS_LOCATION": "~/.auto-roll",
138 } 135 }
139 136
140 def _Steps(self): 137 def _Steps(self):
141 return [ 138 return [
142 Preparation, 139 Preparation,
143 CheckAutoPushSettings, 140 CheckAutoPushSettings,
144 CheckTreeStatus, 141 CheckTreeStatus,
145 FetchLKGR, 142 FetchLKGR,
146 CheckLastPush, 143 CheckLastPush,
147 PushToTrunk, 144 PushToCandidates,
148 ] 145 ]
149 146
150 147
151 if __name__ == "__main__": # pragma: no cover 148 if __name__ == "__main__": # pragma: no cover
152 sys.exit(AutoPush().Run()) 149 sys.exit(AutoPush().Run())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698