]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Allow arc to parse `svnlook` diffs from moves/copies
authorepriestley <git@epriestley.com>
Tue, 1 Apr 2014 15:20:55 +0000 (08:20 -0700)
committerepriestley <git@epriestley.com>
Tue, 1 Apr 2014 15:20:55 +0000 (08:20 -0700)
Summary: Ref T4697. This is similar to the existing stuff, but `svnlook diff ...` can also produce a "Copied" header. Currently, we choke on it in Herald when running pre-commit rules.

Test Plan: Added and ran tests. In the next diff, used this in a real system.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4697

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

src/parser/ArcanistDiffParser.php
src/parser/__tests__/ArcanistDiffParserTestCase.php
src/parser/__tests__/diff/svnlook-copied.svndiff [new file with mode: 0644]

index d3b509bfd976e4d6ac489294250ba65c10f0e0bf..ecf5d4dd93d69c7671aa6f258528dd0c154059ed 100644 (file)
@@ -232,7 +232,7 @@ final class ArcanistDiffParser {
         // This is a normal SVN text change, probably from "svn diff".
         '(?P<type>Index): (?P<cur>.+)',
         // This is an SVN text change, probably from "svnlook diff".
-        '(?P<type>Modified|Added|Deleted): (?P<cur>.+)',
+        '(?P<type>Modified|Added|Deleted|Copied): (?P<cur>.+)',
         // This is an SVN property change, probably from "svn diff".
         '(?P<type>Property changes on): (?P<cur>.+)',
         // This is a git commit message, probably from "git show".
@@ -314,6 +314,7 @@ final class ArcanistDiffParser {
         case 'Modified':
         case 'Added':
         case 'Deleted':
+        case 'Copied':
           $this->parseIndexHunk($change);
           break;
         case 'Property changes on':
index 7be06394674ebe7220cd74cf551bad24c055d1c1..87f4ae45241cf9c4b809b11eb32a719d7055a12e 100644 (file)
@@ -573,6 +573,7 @@ EOTEXT
       case 'svnlook-basics.svndiff':
       case 'svnlook-add.svndiff':
       case 'svnlook-delete.svndiff':
+      case 'svnlook-copied.svndiff':
         $this->assertEqual(1, count($changes));
         break;
       case 'git-format-patch.gitdiff':
diff --git a/src/parser/__tests__/diff/svnlook-copied.svndiff b/src/parser/__tests__/diff/svnlook-copied.svndiff
new file mode 100644 (file)
index 0000000..44463cb
--- /dev/null
@@ -0,0 +1,7 @@
+Copied: movedfile (from rev 30, newfile)
+===================================================================
+--- movedfile                          (rev 0)
++++ movedfile  2014-03-31 02:21:25 UTC (txn 30-1o)
+@@ -0,0 +1,2 @@
++blamo
++blamo