public static function createDiffDict(DifferentialDiff $diff) { $dict = array('id' => $diff->getID(), 'parent' => $diff->getParentRevisionID(), 'sourceControlBaseRevision' => $diff->getSourceControlBaseRevision(), 'sourceControlPath' => $diff->getSourceControlPath(), 'changes' => array()); foreach ($diff->getChangesets() as $changeset) { $hunks = array(); foreach ($changeset->getHunks() as $hunk) { $hunks[] = array('oldOffset' => $hunk->getOldOffset(), 'newOffset' => $hunk->getNewOffset(), 'oldLength' => $hunk->getOldLen(), 'newLength' => $hunk->getNewLen(), 'addLines' => null, 'delLines' => null, 'isMissingOldNewline' => null, 'isMissingNewNewline' => null, 'corpus' => $hunk->getChanges()); } $change = array('metadata' => $changeset->getMetadata(), 'oldPath' => $changeset->getOldFile(), 'currentPath' => $changeset->getFileName(), 'awayPaths' => $changeset->getAwayPaths(), 'oldProperties' => $changeset->getOldProperties(), 'newProperties' => $changeset->getNewProperties(), 'type' => $changeset->getChangeType(), 'fileType' => $changeset->getFileType(), 'commitHash' => null, 'hunks' => $hunks); $dict['changes'][] = $change; } return $dict; }
private function renderBaseRevision(DifferentialDiff $diff) { switch ($diff->getSourceControlSystem()) { case 'git': $base = $diff->getSourceControlBaseRevision(); if (strpos($base, '@') === false) { $label = substr($base, 0, 7); } else { // The diff is from git-svn $base = explode('@', $base); $base = last($base); $label = $base; } break; case 'svn': $base = $diff->getSourceControlBaseRevision(); $base = explode('@', $base); $base = last($base); $label = $base; break; default: $label = null; break; } $link = null; if ($label) { $commit_for_link = idx($this->commitsForLinks, $diff->getSourceControlBaseRevision()); if ($commit_for_link) { $link = phutil_tag('a', array('href' => $commit_for_link->getURI()), $label); } else { $link = $label; } } return $link; }
private function renderBaseRevision(DifferentialDiff $diff) { switch ($diff->getSourceControlSystem()) { case 'git': $base = $diff->getSourceControlBaseRevision(); if (strpos($base, '@') === false) { return substr($base, 0, 7); } else { // The diff is from git-svn $base = explode('@', $base); $base = last($base); return $base; } case 'svn': $base = $diff->getSourceControlBaseRevision(); $base = explode('@', $base); $base = last($base); return $base; default: return null; } }
private function renderBaseRevision(DifferentialDiff $diff) { switch ($diff->getSourceControlSystem()) { case 'git': return substr($diff->getSourceControlBaseRevision(), 0, 7); case 'svn': $base = $diff->getSourceControlBaseRevision(); $base = explode('@', $base); $base = end($base); return $base; default: return null; } }