OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 import textwrap | 40 import textwrap |
41 import time | 41 import time |
42 import urllib | 42 import urllib |
43 import urllib2 | 43 import urllib2 |
44 | 44 |
45 from git_recipes import GitRecipesMixin | 45 from git_recipes import GitRecipesMixin |
46 from git_recipes import GitFailedException | 46 from git_recipes import GitFailedException |
47 | 47 |
48 PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME" | 48 PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME" |
49 BRANCHNAME = "BRANCHNAME" | 49 BRANCHNAME = "BRANCHNAME" |
50 DOT_GIT_LOCATION = "DOT_GIT_LOCATION" | |
51 VERSION_FILE = "VERSION_FILE" | 50 VERSION_FILE = "VERSION_FILE" |
52 CHANGELOG_FILE = "CHANGELOG_FILE" | 51 CHANGELOG_FILE = "CHANGELOG_FILE" |
53 CHANGELOG_ENTRY_FILE = "CHANGELOG_ENTRY_FILE" | 52 CHANGELOG_ENTRY_FILE = "CHANGELOG_ENTRY_FILE" |
54 COMMITMSG_FILE = "COMMITMSG_FILE" | 53 COMMITMSG_FILE = "COMMITMSG_FILE" |
55 PATCH_FILE = "PATCH_FILE" | 54 PATCH_FILE = "PATCH_FILE" |
56 | 55 |
57 # V8 base directory. | 56 # V8 base directory. |
58 DEFAULT_CWD = os.path.dirname( | 57 DEFAULT_CWD = os.path.dirname( |
59 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 58 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
60 | 59 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 for line in self.GitBranch().splitlines(): | 406 for line in self.GitBranch().splitlines(): |
408 if re.match(r"\*?\s*%s$" % re.escape(name), line): | 407 if re.match(r"\*?\s*%s$" % re.escape(name), line): |
409 msg = "Branch %s exists, do you want to delete it?" % name | 408 msg = "Branch %s exists, do you want to delete it?" % name |
410 if self.Confirm(msg): | 409 if self.Confirm(msg): |
411 self.GitDeleteBranch(name) | 410 self.GitDeleteBranch(name) |
412 print "Branch %s deleted." % name | 411 print "Branch %s deleted." % name |
413 else: | 412 else: |
414 msg = "Can't continue. Please delete branch %s and try again." % name | 413 msg = "Can't continue. Please delete branch %s and try again." % name |
415 self.Die(msg) | 414 self.Die(msg) |
416 | 415 |
417 def InitialEnvironmentChecks(self): | 416 def InitialEnvironmentChecks(self, cwd): |
418 # Cancel if this is not a git checkout. | 417 # Cancel if this is not a git checkout. |
419 if not os.path.exists(self._config[DOT_GIT_LOCATION]): # pragma: no cover | 418 if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover |
420 self.Die("This is not a git checkout, this script won't work for you.") | 419 self.Die("This is not a git checkout, this script won't work for you.") |
421 | 420 |
422 # Cancel if EDITOR is unset or not executable. | 421 # Cancel if EDITOR is unset or not executable. |
423 if (self._options.requires_editor and (not os.environ.get("EDITOR") or | 422 if (self._options.requires_editor and (not os.environ.get("EDITOR") or |
424 self.Command( | 423 self.Command( |
425 "which", os.environ["EDITOR"]) is None)): # pragma: no cover | 424 "which", os.environ["EDITOR"]) is None)): # pragma: no cover |
426 self.Die("Please set your EDITOR environment variable, you'll need it.") | 425 self.Die("Please set your EDITOR environment variable, you'll need it.") |
427 | 426 |
428 def CommonPrepare(self): | 427 def CommonPrepare(self): |
429 # Check for a clean workdir. | 428 # Check for a clean workdir. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 for (number, step_class) in enumerate(step_classes): | 707 for (number, step_class) in enumerate(step_classes): |
709 steps.append(MakeStep(step_class, number, self._state, self._config, | 708 steps.append(MakeStep(step_class, number, self._state, self._config, |
710 options, self._side_effect_handler)) | 709 options, self._side_effect_handler)) |
711 for step in steps[options.step:]: | 710 for step in steps[options.step:]: |
712 if step.Run(): | 711 if step.Run(): |
713 return 0 | 712 return 0 |
714 return 0 | 713 return 0 |
715 | 714 |
716 def Run(self, args=None): | 715 def Run(self, args=None): |
717 return self.RunSteps(self._Steps(), args) | 716 return self.RunSteps(self._Steps(), args) |
OLD | NEW |