Page MenuHomePhabricator

D8623.diff
No OneTemporary

D8623.diff

diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php
--- a/src/parser/ArcanistDiffParser.php
+++ b/src/parser/ArcanistDiffParser.php
@@ -459,6 +459,7 @@
$target = null;
$line = $this->nextLine();
+
$prop_index = 2;
while ($line !== null) {
$done = preg_match(
@@ -473,6 +474,7 @@
// and the line with the property change. If we have such a line, we'll
// just ignore it (:
$line = $this->nextLine();
+ // svn1.7 also doesn't put spaces between the +/- and the value
$prop_index = 1;
$trimline = ltrim($line);
}
@@ -498,12 +500,23 @@
$target = null;
}
$line = $trimline;
+ } else {
+ // Only do this for svn1.7 and up (I think, if done all the time
+ // this breaks the multiline test case which has an odd diff format,
+ // but perhaps that's from an older version of svn)
+ if ($prop_index == 1) {
+ $target = 'both';
+ $line = $trimline;
+ }
}
if ($target == 'new') {
$new[] = $line;
} else if ($target == 'old') {
$old[] = $line;
+ } else if ($target == 'both') {
+ $old[] = $line;
+ $new[] = $line;
}
$line = $this->nextLine();
diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php
--- a/src/parser/__tests__/ArcanistDiffParserTestCase.php
+++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php
@@ -111,7 +111,7 @@
$change->getNewProperties());
break;
case 'svn-property-modify.svndiff':
- $this->assertEqual(2, count($changes));
+ $this->assertEqual(3, count($changes));
$change = array_shift($changes);
$this->assertEqual(0, count($change->getHunks()));
@@ -138,6 +138,19 @@
'svn:special' => 'moo',
),
$change->getNewProperties());
+
+ $change = array_shift($changes);
+ $this->assertEqual(0, count($change->getHunks()));
+ $this->assertEqual(
+ array(
+ 'svn:ignore' => "file1.php\nfile2.php\nfile3.php\nfile5.php",
+ ),
+ $change->getOldProperties());
+ $this->assertEqual(
+ array(
+ 'svn:ignore' => "file2.php\nfile3.php\nfile4.php\nfile5.php",
+ ),
+ $change->getNewProperties());
break;
case 'svn-property-delete.svndiff':
$this->assertEqual(1, count($changes));
diff --git a/src/parser/__tests__/diff/svn-property-modify.svndiff b/src/parser/__tests__/diff/svn-property-modify.svndiff
--- a/src/parser/__tests__/diff/svn-property-modify.svndiff
+++ b/src/parser/__tests__/diff/svn-property-modify.svndiff
@@ -13,3 +13,14 @@
- *
+ moo
+
+
+Property changes on: .
+___________________________________________________________________
+Modified: svn:ignore
+## -1,3 +1,2 ##
+-file1.php
+file2.php
+file3.php
++file4.php
+file5.php

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 5:04 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7604176
Default Alt Text
D8623.diff (2 KB)

Event Timeline