args.extend(["--svn-config", self._options.svn_config])
if self._options.vc_interface:
args.extend(["--vc-interface", self._options.vc_interface])
+ if self._options.work_dir:
+ args.extend(["--work-dir", self._options.work_dir])
# TODO(machenbach): Update the script before calling it.
if self._options.push:
"--sheriff", "--googlers-mapping", self._options.googlers_mapping])
if self._options.dry_run:
args.extend(["--dry-run"])
+ if self._options.work_dir:
+ args.extend(["--work-dir", self._options.work_dir])
self._side_effect_handler.Call(chromium_roll.ChromiumRoll().Run, args)
msg = "Can't continue. Please delete branch %s and try again." % name
self.Die(msg)
- def BootstrapV8Checkout(self):
- if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE):
- self.Die("Can't use v8 checkout with calling script as work checkout.")
- # Directory containing the working v8 checkout.
- work_dir = os.path.dirname(self.default_cwd)
- assert os.path.join(work_dir, "v8") == self.default_cwd
-
- if not os.path.exits(work_dir):
- os.makedirs(work_dir)
- if not os.path.exits(self.default_cwd):
- self.Command("fetch", "v8")
-
def InitialEnvironmentChecks(self, cwd):
# Cancel if this is not a git checkout.
if not os.path.exists(os.path.join(cwd, ".git")): # pragma: no cover
cwd=self._options.svn)
+class BootstrapStep(Step):
+ MESSAGE = "Bootstapping v8 checkout."
+
+ def RunStep(self):
+ if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE):
+ self.Die("Can't use v8 checkout with calling script as work checkout.")
+ # Directory containing the working v8 checkout.
+ if not os.path.exists(self._options.work_dir):
+ os.makedirs(self._options.work_dir)
+ if not os.path.exists(self.default_cwd):
+ self.Command("fetch", "v8", cwd=self._options.work_dir)
+
+
class UploadStep(Step):
MESSAGE = "Upload for code review."
os.remove(state_file)
steps = []
- for (number, step_class) in enumerate(step_classes):
+ for (number, step_class) in enumerate([BootstrapStep] + step_classes):
steps.append(MakeStep(step_class, number, self._state, self._config,
options, self._side_effect_handler))
for step in steps[options.step:]:
commit_msg = """Line with "quotation marks"."""
self._TestSquashCommits(change_log, commit_msg)
+ def testBootstrapper(self):
+ work_dir = self.MakeEmptyTempDirectory()
+ class FakeScript(ScriptsBase):
+ def _Steps(self):
+ return []
+
+ # Use the test configuration without the fake testing default work dir.
+ fake_config = dict(TEST_CONFIG)
+ del(fake_config["DEFAULT_CWD"])
+
+ self.Expect([
+ Cmd("fetch v8", "", cwd=work_dir),
+ ])
+ FakeScript(fake_config, self).Run(["--work-dir", work_dir])
+
def _PushToTrunk(self, force=False, manual=False):
TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
# Test that state recovery after restarting the script works.
- args += ["-s", "3"]
+ args += ["-s", "4"]
MergeToBranch(TEST_CONFIG, self).Run(args)
def testMergeToBranchNewGit(self):
lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
# Test that state recovery after restarting the script works.
- args += ["-s", "3"]
+ args += ["-s", "4"]
MergeToBranch(TEST_CONFIG, self).Run(args)
def testReleases(self):