rawCorpus = $corpus; $match = null; if (preg_match('/^Differential Revision:\s*D?(\d+)/m', $corpus, $match)) { $obj->revisionID = (int)$match[1]; } $pattern = '/^git-svn-id:\s*([^@]+)@(\d+)\s+(.*)$/m'; if (preg_match($pattern, $corpus, $match)) { $obj->gitSVNBaseRevision = $match[1].'@'.$match[2]; $obj->gitSVNBasePath = $match[1]; $obj->gitSVNUUID = $match[3]; } return $obj; } public function getRawCorpus() { return $this->rawCorpus; } public function getRevisionID() { return $this->revisionID; } public function pullDataFromConduit(ConduitClient $conduit) { $result = $conduit->callMethod( 'differential.parsecommitmessage', array( 'corpus' => $this->rawCorpus, )); $result = $result->resolve(); if (!empty($result['error'])) { throw new ArcanistDifferentialCommitMessageParserException( $result['error']); } $this->fields = $result['fields']; } public function getFieldValue($key) { if (array_key_exists($key, $this->fields)) { return $this->fields[$key]; } return null; } public function getFields() { return $this->fields; } public function getGitSVNBaseRevision() { return $this->gitSVNBaseRevision; } public function getGitSVNBasePath() { return $this->gitSVNBasePath; } public function getGitSVNUUID() { return $this->gitSVNUUID; } }