]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Reset master after unsuccessful push
authorvrana <jakubv@fb.com>
Tue, 29 Jan 2013 01:05:09 +0000 (17:05 -0800)
committervrana <jakubv@fb.com>
Tue, 29 Jan 2013 20:12:31 +0000 (12:12 -0800)
Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4717

src/workflow/ArcanistLandWorkflow.php

index 772233a4aaf56f17cccd96a913116c6db1a3e147..0839aaf83cf0faca7ea5dec4bdafe27ae11b22de 100644 (file)
@@ -762,6 +762,12 @@ EOTEXT
 
       if ($err) {
         echo phutil_console_format("<bg:red>**   PUSH FAILED!   **</bg>\n");
+        if ($this->isGit) {
+          $repository_api->execxLocal('reset --hard HEAD^');
+          $this->restoreBranch();
+          throw new ArcanistUsageException(
+            "'{$cmd}' failed! Fix the error and run 'arc land' again.");
+        }
         throw new ArcanistUsageException(
           "'{$cmd}' failed! Fix the error and push this change manually.");
       }