From 2198cc2849c8a0d8cdfb1c515a43a61592128533 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 18 Jun 2014 08:35:29 -0700 Subject: [PATCH] Fix an issue with `arc branch` and very old branches Summary: In D9595, we stopped parsing short-form "Differential Revision:" fields in commit messages, and only accept URLs. I have one of the older style commit messages in my local `arcanist/`, so now we go down this parse failure branch in `arc branch`. This has never worked quite correctly, and if the parse fails we end up with a bad branch dictionary that is missing fields. Test Plan: Ran `arc branch` in a working copy with an old `Differential Revision:` field at the head of a branch. Before patch: explosions; after patch: works great. Reviewers: joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D9620 --- src/workflow/ArcanistFeatureWorkflow.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/workflow/ArcanistFeatureWorkflow.php b/src/workflow/ArcanistFeatureWorkflow.php index 378b96b3..4805d22b 100644 --- a/src/workflow/ArcanistFeatureWorkflow.php +++ b/src/workflow/ArcanistFeatureWorkflow.php @@ -197,22 +197,22 @@ EOTEXT list($info) = $future->resolvex(); list($hash, $epoch, $tree, $desc, $text) = explode("\1", trim($info), 5); - $branch = $branches[$name]; - $branch['hash'] = $hash; - $branch['desc'] = $desc; + $branch = $branches[$name] + array( + 'hash' => $hash, + 'desc' => $desc, + 'tree' => $tree, + 'epoch' => (int)$epoch, + ); try { $message = ArcanistDifferentialCommitMessage::newFromRawCorpus($text); $id = $message->getRevisionID(); - $branch += array( - 'epoch' => (int)$epoch, - 'tree' => $tree, - 'revisionID' => $id, - ); + $branch['revisionID'] = $id; } catch (ArcanistUsageException $ex) { // In case of invalid commit message which fails the parsing, // do nothing. + $branch['revisionID'] = null; } $branches[$name] = $branch;