]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Support invalid commit message in "arc branch"
authorJason Ge <jungejason@fb.com>
Mon, 9 Jul 2012 19:05:35 +0000 (12:05 -0700)
committerJason Ge <jungejason@fb.com>
Mon, 9 Jul 2012 19:32:02 +0000 (12:32 -0700)
Summary:
when a commit message contains error which fails the parsing, we 'arc branch' fails. One sample commit message we saw contains

  Differential Revision: 363812, 367983, 370452

The author manually committed the code without a real revision.

Test Plan: ran on the repo with problem commit and it succeeded.

Reviewers: epriestley

Reviewed By: epriestley

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

src/workflow/ArcanistBranchWorkflow.php

index 0ca2f570331eee213c123e7f9368ddd2c1117cf5..1f07aa925b1fe750b96d63bbca9ca34c98679210 100644 (file)
@@ -110,14 +110,18 @@ EOTEXT
     $info = array_filter(explode("\2", trim($info)));
     foreach ($info as $line) {
       list($hash, $epoch, $tree, $text) = explode("\1", trim($line), 4);
-      $message = ArcanistDifferentialCommitMessage::newFromRawCorpus($text);
-      $id = $message->getRevisionID();
-
-      $commit_map[$hash] = array(
-        'epoch'       => (int)$epoch,
-        'tree'        => $tree,
-        'revisionID'  => $id,
-      );
+      try {
+        $message = ArcanistDifferentialCommitMessage::newFromRawCorpus($text);
+        $id = $message->getRevisionID();
+
+        $commit_map[$hash] = array(
+          'epoch'       => (int)$epoch,
+          'tree'        => $tree,
+          'revisionID'  => $id,
+        );
+      } catch (ArcanistUsageException $ex) {
+        // In case of invalid commit message which fails the parsing, do noting.
+      }
     }
 
     return $commit_map;