1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

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
This commit is contained in:
epriestley 2014-06-18 08:35:29 -07:00
parent dd1f93d77b
commit 2198cc2849

View file

@ -197,22 +197,22 @@ EOTEXT
list($info) = $future->resolvex(); list($info) = $future->resolvex();
list($hash, $epoch, $tree, $desc, $text) = explode("\1", trim($info), 5); list($hash, $epoch, $tree, $desc, $text) = explode("\1", trim($info), 5);
$branch = $branches[$name]; $branch = $branches[$name] + array(
$branch['hash'] = $hash; 'hash' => $hash,
$branch['desc'] = $desc; 'desc' => $desc,
'tree' => $tree,
'epoch' => (int)$epoch,
);
try { try {
$message = ArcanistDifferentialCommitMessage::newFromRawCorpus($text); $message = ArcanistDifferentialCommitMessage::newFromRawCorpus($text);
$id = $message->getRevisionID(); $id = $message->getRevisionID();
$branch += array( $branch['revisionID'] = $id;
'epoch' => (int)$epoch,
'tree' => $tree,
'revisionID' => $id,
);
} catch (ArcanistUsageException $ex) { } catch (ArcanistUsageException $ex) {
// In case of invalid commit message which fails the parsing, // In case of invalid commit message which fails the parsing,
// do nothing. // do nothing.
$branch['revisionID'] = null;
} }
$branches[$name] = $branch; $branches[$name] = $branch;