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

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

Issue 171423013: Refactoring: Extract low-level git from push and merge scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correct copyright year. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 self["tree_message"] = json.loads(status_json)["message"] 86 self["tree_message"] = json.loads(status_json)["message"]
87 if re.search(r"nopush|no push", self["tree_message"], flags=re.I): 87 if re.search(r"nopush|no push", self["tree_message"], flags=re.I):
88 self.Die("Push to trunk disabled by tree state: %s" 88 self.Die("Push to trunk disabled by tree state: %s"
89 % self["tree_message"]) 89 % self["tree_message"])
90 90
91 91
92 class FetchLatestRevision(Step): 92 class FetchLatestRevision(Step):
93 MESSAGE = "Fetching latest V8 revision." 93 MESSAGE = "Fetching latest V8 revision."
94 94
95 def RunStep(self): 95 def RunStep(self):
96 log = self.Git("svn log -1 --oneline").strip() 96 match = re.match(r"^r(\d+) ", self.GitSVNLog())
97 match = re.match(r"^r(\d+) ", log)
98 if not match: 97 if not match:
99 self.Die("Could not extract current svn revision from log.") 98 self.Die("Could not extract current svn revision from log.")
100 self["latest"] = match.group(1) 99 self["latest"] = match.group(1)
101 100
102 101
103 class CheckLastPush(Step): 102 class CheckLastPush(Step):
104 MESSAGE = "Checking last V8 push to trunk." 103 MESSAGE = "Checking last V8 push to trunk."
105 104
106 def RunStep(self): 105 def RunStep(self):
107 last_push_hash = self.FindLastTrunkPush() 106 last_push_hash = self.FindLastTrunkPush()
108 last_push = int(self.Git("svn find-rev %s" % last_push_hash).strip()) 107 last_push = int(self.GitSVNFindSVNRev(last_push_hash))
109 108
110 # TODO(machenbach): This metric counts all revisions. It could be 109 # TODO(machenbach): This metric counts all revisions. It could be
111 # improved by counting only the revisions on bleeding_edge. 110 # improved by counting only the revisions on bleeding_edge.
112 if int(self["latest"]) - last_push < 10: 111 if int(self["latest"]) - last_push < 10:
113 # This makes sure the script doesn't push twice in a row when the cron 112 # This makes sure the script doesn't push twice in a row when the cron
114 # job retries several times. 113 # job retries several times.
115 self.Die("Last push too recently: %d" % last_push) 114 self.Die("Last push too recently: %d" % last_push)
116 115
117 116
118 class FetchLKGR(Step): 117 class FetchLKGR(Step):
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 parser = BuildOptions() 203 parser = BuildOptions()
205 (options, args) = parser.parse_args() 204 (options, args) = parser.parse_args()
206 if not options.a or not options.c or not options.reviewer: 205 if not options.a or not options.c or not options.reviewer:
207 print "You need to specify author, chromium src location and reviewer." 206 print "You need to specify author, chromium src location and reviewer."
208 parser.print_help() 207 parser.print_help()
209 return 1 208 return 1
210 RunAutoRoll(CONFIG, AutoRollOptions(options)) 209 RunAutoRoll(CONFIG, AutoRollOptions(options))
211 210
212 if __name__ == "__main__": 211 if __name__ == "__main__":
213 sys.exit(Main()) 212 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698