]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Parse property change diffs generated with old SVN (prior to 1.5)
authorepriestley <git@epriestley.com>
Tue, 19 Feb 2013 15:32:57 +0000 (07:32 -0800)
committerepriestley <git@epriestley.com>
Tue, 19 Feb 2013 15:32:57 +0000 (07:32 -0800)
Summary:
Fixes T2565. SVN from before June 2008 generates different looking property changes.

See http://subversion.tigris.org/issues/show_bug.cgi?id=3019 for the change.

Test Plan: Added a unit test derived from the report in T2565, made it pass.

Reviewers: chad, vrana

Reviewed By: chad

CC: aran
Maniphest Tasks: T2565

Differential Revision: https://secure.phabricator.com/D5009

src/parser/ArcanistDiffParser.php
src/parser/__tests__/ArcanistDiffParserTestCase.php
src/parser/__tests__/diff/svn-property-older-than-1.5.svndiff [new file with mode: 0644]

index 2313cb1cf521a8e639afc721160d55904660b84f..0ba2b247e78a169157152692ce66ef4918371e4f 100644 (file)
@@ -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];
index 494430134667fbca67a5fe7556da83daaf197cb2..7995536c65d5b44829b4e236d413ed8d225f3d38 100644 (file)
@@ -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 (file)
index 0000000..72a5ae6
--- /dev/null
@@ -0,0 +1,4 @@
+Property changes on: ancient/crypt/tomb.COBOL
+___________________________________________________________________
+Name: svn:executable
+   + *