From a36969e58bb4d87e8f922a1985a450573786fe48 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 1 Apr 2014 08:20:55 -0700 Subject: [PATCH] Allow arc to parse `svnlook` diffs from moves/copies 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 | 3 ++- src/parser/__tests__/ArcanistDiffParserTestCase.php | 1 + src/parser/__tests__/diff/svnlook-copied.svndiff | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/parser/__tests__/diff/svnlook-copied.svndiff diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php index d3b509bf..ecf5d4dd 100644 --- a/src/parser/ArcanistDiffParser.php +++ b/src/parser/ArcanistDiffParser.php @@ -232,7 +232,7 @@ final class ArcanistDiffParser { // This is a normal SVN text change, probably from "svn diff". '(?PIndex): (?P.+)', // This is an SVN text change, probably from "svnlook diff". - '(?PModified|Added|Deleted): (?P.+)', + '(?PModified|Added|Deleted|Copied): (?P.+)', // This is an SVN property change, probably from "svn diff". '(?PProperty changes on): (?P.+)', // 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': diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php index 7be06394..87f4ae45 100644 --- a/src/parser/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -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 index 00000000..44463cb8 --- /dev/null +++ b/src/parser/__tests__/diff/svnlook-copied.svndiff @@ -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