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

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

Issue 699493004: Fix push script for autoroll account. (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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return "origin/master" 393 return "origin/master"
394 394
395 def RemoteCandidateBranch(self): 395 def RemoteCandidateBranch(self):
396 return "origin/candidates" 396 return "origin/candidates"
397 397
398 def RemoteBranch(self, name): 398 def RemoteBranch(self, name):
399 if name in ["candidates", "master"]: 399 if name in ["candidates", "master"]:
400 return "origin/%s" % name 400 return "origin/%s" % name
401 return "branch-heads/%s" % name 401 return "branch-heads/%s" % name
402 402
403 def PushRef(self, ref):
404 self.step.Git("push origin %s" % ref)
405
403 def Tag(self, tag, remote, message): 406 def Tag(self, tag, remote, message):
404 # Wait for the commit to appear. Assumes unique commit message titles (this 407 # Wait for the commit to appear. Assumes unique commit message titles (this
405 # is the case for all automated merge and push commits - also no title is 408 # is the case for all automated merge and push commits - also no title is
406 # the prefix of another title). 409 # the prefix of another title).
407 commit = None 410 commit = None
408 for wait_interval in [3, 7, 15, 35, 35]: 411 for wait_interval in [3, 7, 15, 35, 35]:
409 self.step.Git("fetch") 412 self.step.Git("fetch")
410 commit = self.step.GitLog(n=1, format="%H", grep=message, branch=remote) 413 commit = self.step.GitLog(n=1, format="%H", grep=message, branch=remote)
411 if commit: 414 if commit:
412 break 415 break
413 print("The commit has not replicated to git. Waiting for %s seconds." % 416 print("The commit has not replicated to git. Waiting for %s seconds." %
414 wait_interval) 417 wait_interval)
415 self.step._side_effect_handler.Sleep(wait_interval) 418 self.step._side_effect_handler.Sleep(wait_interval)
416 else: 419 else:
417 self.step.Die("Couldn't determine commit for setting the tag. Maybe the " 420 self.step.Die("Couldn't determine commit for setting the tag. Maybe the "
418 "git updater is lagging behind?") 421 "git updater is lagging behind?")
419 422
420 self.step.Git("tag %s %s" % (tag, commit)) 423 self.step.Git("tag %s %s" % (tag, commit))
421 self.step.Git("push origin %s" % tag) 424 self.PushRef(tag)
422 425
423 426
424 class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface): 427 class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface):
425 pass 428 pass
426 429
427 430
428 class GitInterface(GitTagsOnlyMixin): 431 class GitInterface(GitTagsOnlyMixin):
429 def Fetch(self): 432 def Fetch(self):
430 self.step.Git("fetch") 433 self.step.Git("fetch")
431 434
432 def GitSvn(self, hsh, branch=""): 435 def GitSvn(self, hsh, branch=""):
433 return "" 436 return ""
434 437
435 def SvnGit(self, rev, branch=""): 438 def SvnGit(self, rev, branch=""):
436 raise NotImplementedError() 439 raise NotImplementedError()
437 440
438 def Land(self): 441 def Land(self):
442 # FIXME(machenbach): This will not work with checkouts from bot_update
443 # after flag day because it will push to the cache. Investigate if it
444 # will work with "cl land".
439 self.step.Git("push origin") 445 self.step.Git("push origin")
440 446
441 def CLLand(self): 447 def CLLand(self):
442 self.step.GitCLLand() 448 self.step.GitCLLand()
443 449
450 def PushRef(self, ref):
451 self.step.Git("push https://chromium.googlesource.com/v8/v8 %s" % ref)
452
444 453
445 VC_INTERFACES = { 454 VC_INTERFACES = {
446 "git_svn": GitSvnInterface, 455 "git_svn": GitSvnInterface,
447 "git_read_svn_write": GitReadSvnWriteInterface, 456 "git_read_svn_write": GitReadSvnWriteInterface,
448 "git": GitInterface, 457 "git": GitInterface,
449 } 458 }
450 459
451 460
452 class Step(GitRecipesMixin): 461 class Step(GitRecipesMixin):
453 def __init__(self, text, number, config, state, options, handler): 462 def __init__(self, text, number, config, state, options, handler):
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 line = re.sub("\d+$", self[prefix + "patch"], line) 724 line = re.sub("\d+$", self[prefix + "patch"], line)
716 output += "%s\n" % line 725 output += "%s\n" % line
717 TextToFile(output, version_file) 726 TextToFile(output, version_file)
718 727
719 def SVNCommit(self, root, commit_message): 728 def SVNCommit(self, root, commit_message):
720 patch = self.GitDiff("HEAD^", "HEAD") 729 patch = self.GitDiff("HEAD^", "HEAD")
721 TextToFile(patch, self._config["PATCH_FILE"]) 730 TextToFile(patch, self._config["PATCH_FILE"])
722 self.Command("svn", "update", cwd=self._options.svn) 731 self.Command("svn", "update", cwd=self._options.svn)
723 if self.Command("svn", "status", cwd=self._options.svn) != "": 732 if self.Command("svn", "status", cwd=self._options.svn) != "":
724 self.Die("SVN checkout not clean.") 733 self.Die("SVN checkout not clean.")
725 if not self.Command("patch", "-d %s -p1 -i %s" % 734 if not self.Command("patch", "-d %s -p1 -i %s" %
Michael Achenbach 2014/11/02 12:47:03 Just wondering: Will removing files work?
726 (root, self._config["PATCH_FILE"]), 735 (root, self._config["PATCH_FILE"]),
727 cwd=self._options.svn): 736 cwd=self._options.svn):
728 self.Die("Could not apply patch.") 737 self.Die("Could not apply patch.")
738 # Recursively add possibly newly added files.
739 self.Command("svn", "add --force %s" % root, cwd=self._options.svn)
729 self.Command( 740 self.Command(
730 "svn", 741 "svn",
731 "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" % 742 "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" %
732 (self._options.author, self._options.svn_config, commit_message), 743 (self._options.author, self._options.svn_config, commit_message),
733 cwd=self._options.svn) 744 cwd=self._options.svn)
734 745
735 746
736 class UploadStep(Step): 747 class UploadStep(Step):
737 MESSAGE = "Upload for code review." 748 MESSAGE = "Upload for code review."
738 749
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 for (number, step_class) in enumerate(step_classes): 913 for (number, step_class) in enumerate(step_classes):
903 steps.append(MakeStep(step_class, number, self._state, self._config, 914 steps.append(MakeStep(step_class, number, self._state, self._config,
904 options, self._side_effect_handler)) 915 options, self._side_effect_handler))
905 for step in steps[options.step:]: 916 for step in steps[options.step:]:
906 if step.Run(): 917 if step.Run():
907 return 0 918 return 0
908 return 0 919 return 0
909 920
910 def Run(self, args=None): 921 def Run(self, args=None):
911 return self.RunSteps(self._Steps(), args) 922 return self.RunSteps(self._Steps(), args)
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