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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 def DieNoManualMode(self, msg=""): | 504 def DieNoManualMode(self, msg=""): |
505 if not self._options.manual: # pragma: no cover | 505 if not self._options.manual: # pragma: no cover |
506 msg = msg or "Only available in manual mode." | 506 msg = msg or "Only available in manual mode." |
507 self.Die(msg) | 507 self.Die(msg) |
508 | 508 |
509 def Confirm(self, msg): | 509 def Confirm(self, msg): |
510 print "%s [Y/n] " % msg, | 510 print "%s [Y/n] " % msg, |
511 answer = self.ReadLine(default="Y") | 511 answer = self.ReadLine(default="Y") |
512 return answer == "" or answer == "Y" or answer == "y" | 512 return answer == "" or answer == "Y" or answer == "y" |
513 | 513 |
514 def DeleteBranch(self, name): | 514 def DeleteBranch(self, name, cwd=None): |
515 for line in self.GitBranch().splitlines(): | 515 for line in self.GitBranch(cwd=cwd).splitlines(): |
516 if re.match(r"\*?\s*%s$" % re.escape(name), line): | 516 if re.match(r"\*?\s*%s$" % re.escape(name), line): |
517 msg = "Branch %s exists, do you want to delete it?" % name | 517 msg = "Branch %s exists, do you want to delete it?" % name |
518 if self.Confirm(msg): | 518 if self.Confirm(msg): |
519 self.GitDeleteBranch(name) | 519 self.GitDeleteBranch(name, cwd=cwd) |
520 print "Branch %s deleted." % name | 520 print "Branch %s deleted." % name |
521 else: | 521 else: |
522 msg = "Can't continue. Please delete branch %s and try again." % name | 522 msg = "Can't continue. Please delete branch %s and try again." % name |
523 self.Die(msg) | 523 self.Die(msg) |
524 | 524 |
525 def InitialEnvironmentChecks(self, cwd): | 525 def InitialEnvironmentChecks(self, cwd): |
526 # Cancel if this is not a git checkout. | 526 # Cancel if this is not a git checkout. |
527 if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover | 527 if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover |
528 self.Die("This is not a git checkout, this script won't work for you.") | 528 self.Die("This is not a git checkout, this script won't work for you.") |
529 | 529 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 for (number, step_class) in enumerate([BootstrapStep] + step_classes): | 872 for (number, step_class) in enumerate([BootstrapStep] + step_classes): |
873 steps.append(MakeStep(step_class, number, self._state, self._config, | 873 steps.append(MakeStep(step_class, number, self._state, self._config, |
874 options, self._side_effect_handler)) | 874 options, self._side_effect_handler)) |
875 for step in steps[options.step:]: | 875 for step in steps[options.step:]: |
876 if step.Run(): | 876 if step.Run(): |
877 return 0 | 877 return 0 |
878 return 0 | 878 return 0 |
879 | 879 |
880 def Run(self, args=None): | 880 def Run(self, args=None): |
881 return self.RunSteps(self._Steps(), args) | 881 return self.RunSteps(self._Steps(), args) |
OLD | NEW |