diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php index 2313cb1c..0ba2b247 100644 --- a/src/parser/ArcanistDiffParser.php +++ b/src/parser/ArcanistDiffParser.php @@ -377,10 +377,17 @@ final class ArcanistDiffParser { break; } + // NOTE: Before 1.5, SVN uses "Name". At 1.5 and later, SVN uses + // "Modified", "Added" and "Deleted". + $matches = null; - $ok = preg_match('/^(Modified|Added|Deleted): (.*)$/', $line, $matches); + $ok = preg_match( + '/^(Name|Modified|Added|Deleted): (.*)$/', + $line, + $matches); if (!$ok) { - $this->didFailParse("Expected 'Added', 'Deleted', or 'Modified'."); + $this->didFailParse( + "Expected 'Name', 'Added', 'Deleted', or 'Modified'."); } $op = $matches[1]; diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php index 49443013..7995536c 100644 --- a/src/parser/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -190,6 +190,24 @@ Merged /tfb/branches/ads-create-v3/www/html/js/help/UIFaq.js:r140558-142418 EOTEXT )); break; + case 'svn-property-older-than-1.5.svndiff': + // In SVN 1.5, the format for property diffs changed to use the words + // "Added", "Deleted" and "Modified" instead of "Name". This is an old + // property change diff which uses "Name". + $this->assertEqual(1, count($changes)); + $change = reset($changes); + + $this->assertEqual(count($change->getHunks()), 0); + $this->assertEqual( + $change->getOldProperties(), + array( + )); + $this->assertEqual( + $change->getNewProperties(), + array( + 'svn:executable' => '*', + )); + break; case 'svn-binary-add.svndiff': $this->assertEqual(1, count($changes)); $change = reset($changes); diff --git a/src/parser/__tests__/diff/svn-property-older-than-1.5.svndiff b/src/parser/__tests__/diff/svn-property-older-than-1.5.svndiff new file mode 100644 index 00000000..72a5ae62 --- /dev/null +++ b/src/parser/__tests__/diff/svn-property-older-than-1.5.svndiff @@ -0,0 +1,4 @@ +Property changes on: ancient/crypt/tomb.COBOL +___________________________________________________________________ +Name: svn:executable + + *