def testFailDuringCherryPickAndContinueWithoutResolving(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._fail_on_command = 1
        with open(os.path.join(self._target_repo, '.git', 'CHERRY_PICK_HEAD'),
                  'w'):
            pass
        self.assertRaisesRegexp(
            git_drover.Error,
            'All conflicts must be resolved before continuing',
            git_drover.continue_cherry_pick, self._target_repo)
        self.assertEqual(self.FINISH_MANUAL_RESOLVE_COMMANDS, self._commands)
        self.assertTrue(os.path.exists(self._target_repo))

        self._commands = []
        git_drover.abort_cherry_pick(self._target_repo)
        self.assertEqual(self.BRANCH_CLEANUP_COMMANDS, self._commands)
        self.assertFalse(os.path.exists(self._target_repo))
Ejemplo n.º 2
0
 def testFailDuringCherryPickAndAbort(self):
   self._input = ['y']
   self._fail_on_command = 10
   self.assertRaises(git_drover.Error, 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 = []
   git_drover.abort_cherry_pick(self._target_repo)
   self.assertEqual(self.BRANCH_CLEANUP_COMMANDS, self._commands)
   self.assertFalse(os.path.exists(self._target_repo))
Ejemplo n.º 3
0
 def testFailDuringCherryPickAndAbort(self):
   self._input = ['y']
   self._fail_on_command = 10
   self.assertRaises(git_drover.Error, 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 = []
   git_drover.abort_cherry_pick(self._target_repo)
   self.assertEqual(self.BRANCH_CLEANUP_COMMANDS, self._commands)
   self.assertFalse(os.path.exists(self._target_repo))
Ejemplo n.º 4
0
  def testFailDuringCherryPickAndContinueWithoutResolving(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._fail_on_command = 1
    with open(os.path.join(self._target_repo, '.git', 'CHERRY_PICK_HEAD'), 'w'):
      pass
    self.assertRaisesRegexp(git_drover.Error,
                            'All conflicts must be resolved before continuing',
                            git_drover.continue_cherry_pick, self._target_repo)
    self.assertEqual(self.FINISH_MANUAL_RESOLVE_COMMANDS, self._commands)
    self.assertTrue(os.path.exists(self._target_repo))

    self._commands = []
    git_drover.abort_cherry_pick(self._target_repo)
    self.assertEqual(self.BRANCH_CLEANUP_COMMANDS, self._commands)
    self.assertFalse(os.path.exists(self._target_repo))