def testFailDuringCherryPickAndContinue(self):
        self._input = ['y']
        self._fail_on_command = 10
        self.assertRaises(git_drover.PatchError, git_drover.cherry_pick_change,
                          'branch', 'cl', self._parent_repo, False)
        self.assertEqual(
            self.REPO_CHECK_COMMANDS + self.LOCAL_REPO_COMMANDS[:4] +
            self.MANUAL_RESOLVE_PREPARATION_COMMANDS, self._commands)
        self.assertTrue(os.path.exists(self._target_repo))
        self.assertFalse(self._input)

        self._commands = []
        self._input = ['n']
        git_drover.continue_cherry_pick(self._target_repo)
        self.assertEqual(self.UPLOAD_COMMANDS, self._commands)
        self.assertTrue(os.path.exists(self._target_repo))
        self.assertFalse(self._input)

        self._commands = []
        self._input = ['y']
        git_drover.continue_cherry_pick(self._target_repo)
        self.assertEqual(
            self.UPLOAD_COMMANDS + self.LAND_COMMAND +
            self.BRANCH_CLEANUP_COMMANDS, self._commands)
        self.assertFalse(os.path.exists(self._target_repo))
        self.assertFalse(self._input)
Ejemplo n.º 2
0
  def testFailDuringCherryPickAndContinue(self):
    self._input = ['y']
    self._fail_on_command = 10
    self.assertRaises(git_drover.PatchError, git_drover.cherry_pick_change,
                      'branch', 'cl', self._parent_repo, False)
    self.assertEqual(self.REPO_CHECK_COMMANDS + self.LOCAL_REPO_COMMANDS[:4] +
                     self.MANUAL_RESOLVE_PREPARATION_COMMANDS, self._commands)
    self.assertTrue(os.path.exists(self._target_repo))
    self.assertFalse(self._input)

    self._commands = []
    self._input = ['n']
    git_drover.continue_cherry_pick(self._target_repo)
    self.assertEqual(self.UPLOAD_COMMANDS, self._commands)
    self.assertTrue(os.path.exists(self._target_repo))
    self.assertFalse(self._input)

    self._commands = []
    self._input = ['y']
    git_drover.continue_cherry_pick(self._target_repo)
    self.assertEqual(
        self.UPLOAD_COMMANDS + self.LAND_COMMAND + self.BRANCH_CLEANUP_COMMANDS,
        self._commands)
    self.assertFalse(os.path.exists(self._target_repo))
    self.assertFalse(self._input)