From 31a390a38c96b7eb32d35ce50f14697ccff5ee47 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 20 Feb 2013 13:24:14 -0800 Subject: [PATCH] Fix issue with SVN property changes under Windows Summary: We were incorrectly matching `$` in the regexp against a possible `\r\n`. I missed this earlier when trying to catch all of these. Test Plan: - Added unit test and made it pass. - Did another search for `getLine()` to see if I could spot any more of these, but failed to identify any via inspection. Reviewers: vrana, mbishopim3 Reviewed By: mbishopim3 CC: aran Differential Revision: https://secure.phabricator.com/D5038 --- src/parser/ArcanistDiffParser.php | 2 +- src/parser/__tests__/ArcanistDiffParserTestCase.php | 3 +++ .../__tests__/diff/svn-property-windows.svndiff | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/parser/__tests__/diff/svn-property-windows.svndiff diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php index 0ba2b247..180ce700 100644 --- a/src/parser/ArcanistDiffParser.php +++ b/src/parser/ArcanistDiffParser.php @@ -365,7 +365,7 @@ final class ArcanistDiffParser { * (or any other parser) with a carefully constructed property change. */ protected function parsePropertyHunk(ArcanistDiffChange $change) { - $line = $this->getLine(); + $line = $this->getLineTrimmed(); if (!preg_match('/^_+$/', $line)) { $this->didFailParse("Expected '______________________'."); } diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php index 1ef73820..e4ddec81 100644 --- a/src/parser/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -546,6 +546,9 @@ EOTEXT case 'suppress-blank-empty.gitdiff': $this->assertEqual(1, count($changes)); break; + case 'svn-property-windows.svndiff': + $this->assertEqual(1, count($changes)); + break; default: throw new Exception("No test block for diff file {$diff_file}."); break; diff --git a/src/parser/__tests__/diff/svn-property-windows.svndiff b/src/parser/__tests__/diff/svn-property-windows.svndiff new file mode 100644 index 00000000..bbe367fe --- /dev/null +++ b/src/parser/__tests__/diff/svn-property-windows.svndiff @@ -0,0 +1,11 @@ +Index: .arcconfig +=================================================================== +--- .arcconfig (revision 1957) ++++ .arcconfig (working copy) + +Property changes on: .arcconfig +___________________________________________________________________ +Added: herp +## -0,0 +1 ## ++derp +\ No newline at end of property