Changeset View
Changeset View
Standalone View
Standalone View
src/differential/ArcanistDifferentialCommitMessage.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Represents a parsed commit message. | * Represents a parsed commit message. | ||||
| */ | */ | ||||
| final class ArcanistDifferentialCommitMessage extends Phobject { | final class ArcanistDifferentialCommitMessage extends Phobject { | ||||
| private $rawCorpus; | private $rawCorpus; | ||||
| private $revisionID; | private $revisionID; | ||||
| private $fields = array(); | private $fields = array(); | ||||
| private $xactions = null; | |||||
| private $gitSVNBaseRevision; | private $gitSVNBaseRevision; | ||||
| private $gitSVNBasePath; | private $gitSVNBasePath; | ||||
| private $gitSVNUUID; | private $gitSVNUUID; | ||||
| public static function newFromRawCorpus($corpus) { | public static function newFromRawCorpus($corpus) { | ||||
| $obj = new ArcanistDifferentialCommitMessage(); | $obj = new ArcanistDifferentialCommitMessage(); | ||||
| $obj->rawCorpus = $corpus; | $obj->rawCorpus = $corpus; | ||||
| Show All 26 Lines | $result = $conduit->callMethodSynchronous( | ||||
| 'differential.parsecommitmessage', | 'differential.parsecommitmessage', | ||||
| array( | array( | ||||
| 'corpus' => $this->rawCorpus, | 'corpus' => $this->rawCorpus, | ||||
| 'partial' => $partial, | 'partial' => $partial, | ||||
| )); | )); | ||||
| $this->fields = $result['fields']; | $this->fields = $result['fields']; | ||||
| // NOTE: This does not exist prior to late October 2017. | |||||
| $this->xactions = idx($result, 'transactions'); | |||||
| if (!empty($result['errors'])) { | if (!empty($result['errors'])) { | ||||
| throw new ArcanistDifferentialCommitMessageParserException( | throw new ArcanistDifferentialCommitMessageParserException( | ||||
| $result['errors']); | $result['errors']); | ||||
| } | } | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| Show All 27 Lines | final class ArcanistDifferentialCommitMessage extends Phobject { | ||||
| public function getChecksum() { | public function getChecksum() { | ||||
| $fields = array_filter($this->fields); | $fields = array_filter($this->fields); | ||||
| ksort($fields); | ksort($fields); | ||||
| $fields = json_encode($fields); | $fields = json_encode($fields); | ||||
| return md5($fields); | return md5($fields); | ||||
| } | } | ||||
| public function getTransactions() { | |||||
| return $this->xactions; | |||||
| } | |||||
| /** | /** | ||||
| * Extract the revision ID from a commit message. | * Extract the revision ID from a commit message. | ||||
| * | * | ||||
| * @param string Raw commit message. | * @param string Raw commit message. | ||||
| * @return int|null Revision ID, if the commit message contains one. | * @return int|null Revision ID, if the commit message contains one. | ||||
| */ | */ | ||||
| private function parseRevisionIDFromRawCorpus($corpus) { | private function parseRevisionIDFromRawCorpus($corpus) { | ||||
| $match = null; | $match = null; | ||||
| Show All 31 Lines | |||||