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

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

Issue 200763013: Directly modify version file on trunk branch in push-to-trunk. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 class StragglerCommits(Step): 243 class StragglerCommits(Step):
244 MESSAGE = ("Fetch straggler commits that sneaked in since this script was " 244 MESSAGE = ("Fetch straggler commits that sneaked in since this script was "
245 "started.") 245 "started.")
246 246
247 def RunStep(self): 247 def RunStep(self):
248 self.GitSVNFetch() 248 self.GitSVNFetch()
249 self.GitCheckout("svn/bleeding_edge") 249 self.GitCheckout("svn/bleeding_edge")
250 self["prepare_commit_hash"] = self.GitLog(n=1, format="%H", 250 self["prepare_commit_hash"] = self.GitLog(n=1, format="%H",
251 grep=self["prep_commit_msg"]) 251 grep=self["prep_commit_msg"])
252 # TODO(machenbach): Retrieve the push hash from a command-line option or
253 # use ToT. The "prepare_commit_hash" will be deprecated along with the
254 # prepare push commit.
255 self["push_hash"] = self.GitLog(n=1, format="%H",
256 parent_hash=self["prepare_commit_hash"])
252 257
253 258
254 class SquashCommits(Step): 259 class SquashCommits(Step):
255 MESSAGE = "Squash commits into one." 260 MESSAGE = "Squash commits into one."
256 261
257 def RunStep(self): 262 def RunStep(self):
258 # Instead of relying on "git rebase -i", we'll just create a diff, because 263 # Instead of relying on "git rebase -i", we'll just create a diff, because
259 # that's easier to automate. 264 # that's easier to automate.
260 TextToFile(self.GitDiff("svn/trunk", self["prepare_commit_hash"]), 265 TextToFile(self.GitDiff("svn/trunk", self["push_hash"]),
261 self.Config(PATCH_FILE)) 266 self.Config(PATCH_FILE))
262 267
263 # Convert the ChangeLog entry to commit message format. 268 # Convert the ChangeLog entry to commit message format.
264 text = FileToText(self.Config(CHANGELOG_ENTRY_FILE)) 269 text = FileToText(self.Config(CHANGELOG_ENTRY_FILE))
265 270
266 # Remove date and trailing white space. 271 # Remove date and trailing white space.
267 text = re.sub(r"^%s: " % self["date"], "", text.rstrip()) 272 text = re.sub(r"^%s: " % self["date"], "", text.rstrip())
268 273
269 # Retrieve svn revision for showing the used bleeding edge revision in the 274 # Retrieve svn revision for showing the used bleeding edge revision in the
270 # commit message. 275 # commit message.
271 self["svn_revision"] = self.GitSVNFindSVNRev(self["prepare_commit_hash"]) 276 self["svn_revision"] = self.GitSVNFindSVNRev(self["push_hash"])
272 suffix = PUSH_MESSAGE_SUFFIX % int(self["svn_revision"]) 277 suffix = PUSH_MESSAGE_SUFFIX % int(self["svn_revision"])
273 text = MSub(r"^(Version \d+\.\d+\.\d+)$", "\\1%s" % suffix, text) 278 text = MSub(r"^(Version \d+\.\d+\.\d+)$", "\\1%s" % suffix, text)
274 279
275 # Remove indentation and merge paragraphs into single long lines, keeping 280 # Remove indentation and merge paragraphs into single long lines, keeping
276 # empty lines between them. 281 # empty lines between them.
277 def SplitMapJoin(split_text, fun, join_text): 282 def SplitMapJoin(split_text, fun, join_text):
278 return lambda text: join_text.join(map(fun, text.split(split_text))) 283 return lambda text: join_text.join(map(fun, text.split(split_text)))
279 strip = lambda line: line.strip() 284 strip = lambda line: line.strip()
280 text = SplitMapJoin("\n\n", SplitMapJoin("\n", strip, " "), "\n\n")(text) 285 text = SplitMapJoin("\n\n", SplitMapJoin("\n", strip, " "), "\n\n")(text)
281 286
(...skipping 29 matching lines...) Expand all
311 old_change_log = FileToText(self.Config(CHANGELOG_FILE)) 316 old_change_log = FileToText(self.Config(CHANGELOG_FILE))
312 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) 317 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log)
313 TextToFile(new_change_log, self.Config(CHANGELOG_FILE)) 318 TextToFile(new_change_log, self.Config(CHANGELOG_FILE))
314 os.remove(self.Config(CHANGELOG_ENTRY_FILE)) 319 os.remove(self.Config(CHANGELOG_ENTRY_FILE))
315 320
316 321
317 class SetVersion(Step): 322 class SetVersion(Step):
318 MESSAGE = "Set correct version for trunk." 323 MESSAGE = "Set correct version for trunk."
319 324
320 def RunStep(self): 325 def RunStep(self):
326 # The version file has been modified by the patch. Reset it to the version
327 # on trunk and apply the correct version.
328 self.GitCheckoutFile(self.Config(VERSION_FILE), "svn/trunk")
321 output = "" 329 output = ""
322 for line in FileToText(self.Config(VERSION_FILE)).splitlines(): 330 for line in FileToText(self.Config(VERSION_FILE)).splitlines():
323 if line.startswith("#define MAJOR_VERSION"): 331 if line.startswith("#define MAJOR_VERSION"):
324 line = re.sub("\d+$", self["major"], line) 332 line = re.sub("\d+$", self["major"], line)
325 elif line.startswith("#define MINOR_VERSION"): 333 elif line.startswith("#define MINOR_VERSION"):
326 line = re.sub("\d+$", self["minor"], line) 334 line = re.sub("\d+$", self["minor"], line)
327 elif line.startswith("#define BUILD_NUMBER"): 335 elif line.startswith("#define BUILD_NUMBER"):
328 line = re.sub("\d+$", self["build"], line) 336 line = re.sub("\d+$", self["build"], line)
329 elif line.startswith("#define PATCH_LEVEL"): 337 elif line.startswith("#define PATCH_LEVEL"):
330 line = re.sub("\d+$", "0", line) 338 line = re.sub("\d+$", "0", line)
331 elif line.startswith("#define IS_CANDIDATE_VERSION"): 339 elif line.startswith("#define IS_CANDIDATE_VERSION"):
332 line = re.sub("\d+$", "0", line) 340 line = re.sub("\d+$", "0", line)
333 output += "%s\n" % line 341 output += "%s\n" % line
334 TextToFile(output, self.Config(VERSION_FILE)) 342 TextToFile(output, self.Config(VERSION_FILE))
335 343
336 344
337 class CommitTrunk(Step): 345 class CommitTrunk(Step):
338 MESSAGE = "Commit to local trunk branch." 346 MESSAGE = "Commit to local trunk branch."
339 347
340 def RunStep(self): 348 def RunStep(self):
341 self.GitAdd(self.Config(VERSION_FILE))
Jakob Kummerow 2014/03/19 10:24:09 Are you sure we don't need this anymore, having ju
342 self.GitCommit(file_name = self.Config(COMMITMSG_FILE)) 349 self.GitCommit(file_name = self.Config(COMMITMSG_FILE))
343 Command("rm", "-f %s*" % self.Config(COMMITMSG_FILE)) 350 Command("rm", "-f %s*" % self.Config(COMMITMSG_FILE))
344 351
345 352
346 class SanityCheck(Step): 353 class SanityCheck(Step):
347 MESSAGE = "Sanity check." 354 MESSAGE = "Sanity check."
348 355
349 def RunStep(self): 356 def RunStep(self):
350 if not self.Confirm("Please check if your local checkout is sane: Inspect " 357 if not self.Confirm("Please check if your local checkout is sane: Inspect "
351 "%s, compile, run tests. Do you want to commit this new trunk " 358 "%s, compile, run tests. Do you want to commit this new trunk "
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 SwitchChromium, 549 SwitchChromium,
543 UpdateChromiumCheckout, 550 UpdateChromiumCheckout,
544 UploadCL, 551 UploadCL,
545 SwitchV8, 552 SwitchV8,
546 CleanUp, 553 CleanUp,
547 ] 554 ]
548 555
549 556
550 if __name__ == "__main__": # pragma: no cover 557 if __name__ == "__main__": # pragma: no cover
551 sys.exit(PushToTrunk(CONFIG).Run()) 558 sys.exit(PushToTrunk(CONFIG).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