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

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

Issue 700493002: Fix workdir feature for release scripts. (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 | « tools/push-to-trunk/auto_roll.py ('k') | 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 for line in self.GitBranch().splitlines(): 601 for line in self.GitBranch().splitlines():
602 if re.match(r"\*?\s*%s$" % re.escape(name), line): 602 if re.match(r"\*?\s*%s$" % re.escape(name), line):
603 msg = "Branch %s exists, do you want to delete it?" % name 603 msg = "Branch %s exists, do you want to delete it?" % name
604 if self.Confirm(msg): 604 if self.Confirm(msg):
605 self.GitDeleteBranch(name) 605 self.GitDeleteBranch(name)
606 print "Branch %s deleted." % name 606 print "Branch %s deleted." % name
607 else: 607 else:
608 msg = "Can't continue. Please delete branch %s and try again." % name 608 msg = "Can't continue. Please delete branch %s and try again." % name
609 self.Die(msg) 609 self.Die(msg)
610 610
611 def BootstrapV8Checkout(self):
612 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE):
613 self.Die("Can't use v8 checkout with calling script as work checkout.")
614 # Directory containing the working v8 checkout.
615 work_dir = os.path.dirname(self.default_cwd)
616 assert os.path.join(work_dir, "v8") == self.default_cwd
617
618 if not os.path.exits(work_dir):
619 os.makedirs(work_dir)
620 if not os.path.exits(self.default_cwd):
621 self.Command("fetch", "v8")
622
623 def InitialEnvironmentChecks(self, cwd): 611 def InitialEnvironmentChecks(self, cwd):
624 # Cancel if this is not a git checkout. 612 # Cancel if this is not a git checkout.
625 if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover 613 if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover
626 self.Die("This is not a git checkout, this script won't work for you.") 614 self.Die("This is not a git checkout, this script won't work for you.")
627 615
628 # Cancel if EDITOR is unset or not executable. 616 # Cancel if EDITOR is unset or not executable.
629 if (self._options.requires_editor and (not os.environ.get("EDITOR") or 617 if (self._options.requires_editor and (not os.environ.get("EDITOR") or
630 self.Command( 618 self.Command(
631 "which", os.environ["EDITOR"]) is None)): # pragma: no cover 619 "which", os.environ["EDITOR"]) is None)): # pragma: no cover
632 self.Die("Please set your EDITOR environment variable, you'll need it.") 620 self.Die("Please set your EDITOR environment variable, you'll need it.")
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 self.Die("Could not apply patch.") 738 self.Die("Could not apply patch.")
751 # Recursively add possibly newly added files. 739 # Recursively add possibly newly added files.
752 self.Command("svn", "add --force %s" % root, cwd=self._options.svn) 740 self.Command("svn", "add --force %s" % root, cwd=self._options.svn)
753 self.Command( 741 self.Command(
754 "svn", 742 "svn",
755 "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" % 743 "commit --non-interactive --username=%s --config-dir=%s -m \"%s\"" %
756 (self._options.author, self._options.svn_config, commit_message), 744 (self._options.author, self._options.svn_config, commit_message),
757 cwd=self._options.svn) 745 cwd=self._options.svn)
758 746
759 747
748 class BootstrapStep(Step):
749 MESSAGE = "Bootstapping v8 checkout."
750
751 def RunStep(self):
752 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE):
753 self.Die("Can't use v8 checkout with calling script as work checkout.")
754 # Directory containing the working v8 checkout.
755 if not os.path.exists(self._options.work_dir):
756 os.makedirs(self._options.work_dir)
757 if not os.path.exists(self.default_cwd):
758 self.Command("fetch", "v8", cwd=self._options.work_dir)
759
760
760 class UploadStep(Step): 761 class UploadStep(Step):
761 MESSAGE = "Upload for code review." 762 MESSAGE = "Upload for code review."
762 763
763 def RunStep(self): 764 def RunStep(self):
764 if self._options.reviewer: 765 if self._options.reviewer:
765 print "Using account %s for review." % self._options.reviewer 766 print "Using account %s for review." % self._options.reviewer
766 reviewer = self._options.reviewer 767 reviewer = self._options.reviewer
767 else: 768 else:
768 print "Please enter the email address of a V8 reviewer for your patch: ", 769 print "Please enter the email address of a V8 reviewer for your patch: ",
769 self.DieNoManualMode("A reviewer must be specified in forced mode.") 770 self.DieNoManualMode("A reviewer must be specified in forced mode.")
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 def RunSteps(self, step_classes, args=None): 922 def RunSteps(self, step_classes, args=None):
922 options = self.MakeOptions(args) 923 options = self.MakeOptions(args)
923 if not options: 924 if not options:
924 return 1 925 return 1
925 926
926 state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"] 927 state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"]
927 if options.step == 0 and os.path.exists(state_file): 928 if options.step == 0 and os.path.exists(state_file):
928 os.remove(state_file) 929 os.remove(state_file)
929 930
930 steps = [] 931 steps = []
931 for (number, step_class) in enumerate(step_classes): 932 for (number, step_class) in enumerate([BootstrapStep] + step_classes):
932 steps.append(MakeStep(step_class, number, self._state, self._config, 933 steps.append(MakeStep(step_class, number, self._state, self._config,
933 options, self._side_effect_handler)) 934 options, self._side_effect_handler))
934 for step in steps[options.step:]: 935 for step in steps[options.step:]:
935 if step.Run(): 936 if step.Run():
936 return 0 937 return 0
937 return 0 938 return 0
938 939
939 def Run(self, args=None): 940 def Run(self, args=None):
940 return self.RunSteps(self._Steps(), args) 941 return self.RunSteps(self._Steps(), args)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/auto_roll.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698