Changeset View
Changeset View
Standalone View
Standalone View
src/parser/ArcanistDiffParser.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Parses diffs from a working copy. | * Parses diffs from a working copy. | ||||
| * | |||||
| * @group diff | |||||
| */ | */ | ||||
| final class ArcanistDiffParser { | final class ArcanistDiffParser { | ||||
| protected $repositoryAPI; | protected $repositoryAPI; | ||||
| protected $text; | protected $text; | ||||
| protected $line; | protected $line; | ||||
| protected $lineSaved; | protected $lineSaved; | ||||
| protected $isGit; | protected $isGit; | ||||
| ▲ Show 20 Lines • Show All 433 Lines • ▼ Show 20 Lines | while ($line !== null) { | ||||
| $change->setNewProperty($prop, $new); | $change->setNewProperty($prop, $new); | ||||
| } | } | ||||
| $line = $this->getLine(); | $line = $this->getLine(); | ||||
| } | } | ||||
| } | } | ||||
| private function parseSVNPropertyChange($op, $prop) { | private function parseSVNPropertyChange($op, $prop) { | ||||
| $old = array(); | $old = array(); | ||||
| $new = array(); | $new = array(); | ||||
| $target = null; | $target = null; | ||||
| $line = $this->nextLine(); | $line = $this->nextLine(); | ||||
| $prop_index = 2; | $prop_index = 2; | ||||
| while ($line !== null) { | while ($line !== null) { | ||||
| ▲ Show 20 Lines • Show All 908 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * Strip the header and footer off a `git-format-patch` diff. | * Strip the header and footer off a `git-format-patch` diff. | ||||
| * | * | ||||
| * Returns a parseable normal diff and a textual commit message. | * Returns a parseable normal diff and a textual commit message. | ||||
| */ | */ | ||||
| private function stripGitFormatPatch($diff) { | private function stripGitFormatPatch($diff) { | ||||
| // We can parse this by splitting it into two pieces over and over again | // We can parse this by splitting it into two pieces over and over again | ||||
| // along different section dividers: | // along different section dividers: | ||||
| // | // | ||||
| // 1. Mail headers. | // 1. Mail headers. | ||||
| // 2. ("\n\n") | // 2. ("\n\n") | ||||
| // 3. Mail body. | // 3. Mail body. | ||||
| // 4. ("---") | // 4. ("---") | ||||
| // 5. Diff stat section. | // 5. Diff stat section. | ||||
| Show All 23 Lines | |||||