Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/data/DiffusionPathChange.php
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | if (!$this->getCommitData()) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $message = $this->getCommitData()->getCommitMessage(); | $message = $this->getCommitData()->getCommitMessage(); | ||||
| $first = idx(explode("\n", $message), 0); | $first = idx(explode("\n", $message), 0); | ||||
| return substr($first, 0, 80); | return substr($first, 0, 80); | ||||
| } | } | ||||
| final public static function convertToArcanistChanges(array $changes) { | final public static function convertToArcanistChanges(array $changes) { | ||||
| assert_instances_of($changes, 'DiffusionPathChange'); | assert_instances_of($changes, __CLASS__); | ||||
| $direct = array(); | $direct = array(); | ||||
| $result = array(); | $result = array(); | ||||
| foreach ($changes as $path) { | foreach ($changes as $path) { | ||||
| $change = new ArcanistDiffChange(); | $change = new ArcanistDiffChange(); | ||||
| $change->setCurrentPath($path->getPath()); | $change->setCurrentPath($path->getPath()); | ||||
| $direct[] = $path->getPath(); | $direct[] = $path->getPath(); | ||||
| $change->setType($path->getChangeType()); | $change->setType($path->getChangeType()); | ||||
| $file_type = $path->getFileType(); | $file_type = $path->getFileType(); | ||||
| Show All 9 Lines | final public static function convertToArcanistChanges(array $changes) { | ||||
| } | } | ||||
| return array_select_keys($result, $direct); | return array_select_keys($result, $direct); | ||||
| } | } | ||||
| final public static function convertToDifferentialChangesets( | final public static function convertToDifferentialChangesets( | ||||
| PhabricatorUser $user, | PhabricatorUser $user, | ||||
| array $changes) { | array $changes) { | ||||
| assert_instances_of($changes, 'DiffusionPathChange'); | assert_instances_of($changes, __CLASS__); | ||||
| $arcanist_changes = self::convertToArcanistChanges($changes); | $arcanist_changes = self::convertToArcanistChanges($changes); | ||||
| $diff = DifferentialDiff::newEphemeralFromRawChanges( | $diff = DifferentialDiff::newEphemeralFromRawChanges( | ||||
| $arcanist_changes); | $arcanist_changes); | ||||
| return $diff->getChangesets(); | return $diff->getChangesets(); | ||||
| } | } | ||||
| public function toDictionary() { | public function toDictionary() { | ||||
| $commit = $this->getCommit(); | $commit = $this->getCommit(); | ||||
| ▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines | |||||