From a9099912bbff6b829190d5ef40844d3c00e53add Mon Sep 17 00:00:00 2001
From: Jakub Vrana <jakub@vrana.cz>
Date: Tue, 16 Apr 2013 08:28:38 -0700
Subject: [PATCH] Handle SVN root changes correctly

Summary: If there is a change in SVN root (perhaps properties change) then we try to list its parent (which doesn't exist) and mark the root itself as deleted.

Test Plan: Parsed SVN commit with property change of root.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5709
---
 .../PhabricatorRepositorySvnCommitChangeParserWorker.php  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
index f6d3a26b94..cff194e04f 100644
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
@@ -570,8 +570,14 @@ final class PhabricatorRepositorySvnCommitChangeParserWorker
     PhabricatorRepository $repository,
     array $paths) {
 
+    $result_map = array();
     $repository_uri = $repository->getDetail('remote-uri');
 
+    if (isset($paths['/'])) {
+      $result_map['/'] = DifferentialChangeType::FILE_DIRECTORY;
+      unset($paths['/']);
+    }
+
     $parents = array();
     $path_mapping = array();
     foreach ($paths as $path => $lookup) {
@@ -584,8 +590,6 @@ final class PhabricatorRepositorySvnCommitChangeParserWorker
       $path_mapping[$parent][] = dirname($path);
     }
 
-    $result_map = array();
-
     // Reverse this list so we can pop $path_mapping, as that's more efficient
     // than shifting it. We need to associate these maps positionally because
     // a change can copy the same source path from multiple revisions via