From 178b7346a14750a1468125d990e50aedb47be9de Mon Sep 17 00:00:00 2001 From: Jason Ge Date: Mon, 9 Jul 2012 12:05:35 -0700 Subject: [PATCH] Support invalid commit message in "arc branch" 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 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/workflow/ArcanistBranchWorkflow.php b/src/workflow/ArcanistBranchWorkflow.php index 0ca2f570..1f07aa92 100644 --- a/src/workflow/ArcanistBranchWorkflow.php +++ b/src/workflow/ArcanistBranchWorkflow.php @@ -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; -- 2.43.0