revertAll() public method

Reverts all changes up to a given commit - performs a "rollback"
public revertAll ( $commitHash )
$commitHash
Ejemplo n.º 1
0
 private function revertToCommit($commitHash)
 {
     $this->repository->revertAll($commitHash);
     if (!$this->repository->willCommit()) {
         return RevertStatus::NOTHING_TO_COMMIT;
     }
     return RevertStatus::OK;
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function revertAllCanRevertToCommitInParallelBranch()
 {
     VPCommandUtils::exec('git branch test', self::$repositoryPath);
     $this->commitFile('some-file', 'Some commit');
     VPCommandUtils::exec('git checkout test', self::$repositoryPath);
     $this->commitFile('other-file', 'Other commit');
     $hash = self::$repository->getLastCommitHash();
     VPCommandUtils::exec('git checkout master', self::$repositoryPath);
     VPCommandUtils::exec('git merge test', self::$repositoryPath);
     $commitAsserter = $this->createCommitAsserter();
     self::$repository->revertAll($hash);
     $this->commit('Revert all');
     $commitAsserter->assertNumCommits(1);
     $commitAsserter->assertCleanWorkingDirectory();
     $commitAsserter->assertCountOfAffectedFiles(1);
     $commitAsserter->assertCommitPath('D', 'some-file');
 }