diff --git a/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php b/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php index 1d7dd7f1e6..80f3348f76 100644 --- a/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php +++ b/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php @@ -75,6 +75,14 @@ final class DiffusionSvnDiffQuery extends DiffusionDiffQuery { $old_name = $path->getTargetPath(); $new_name = $path->getPath(); break; + case DifferentialChangeType::TYPE_MOVE_AWAY: + $old = array( + $path->getPath(), + $path->getCommitIdentifier() - 1); + $old_name = $path->getPath(); + $new_name = null; + $new = null; + break; default: $old = array($path->getPath(), $path->getCommitIdentifier() - 1); $new = array($path->getPath(), $path->getCommitIdentifier()); diff --git a/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php b/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php index 241c9e3d9b..d97d4cc711 100644 --- a/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php +++ b/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php @@ -49,21 +49,21 @@ class DiffusionPathChangeQuery { $raw_changes = queryfx_all( $repository->establishConnection('r'), - 'SELECT c.*, p.path pathName, t.path targetPathName + 'SELECT c.*, p.path pathName, t.path targetPathName, + i.commitIdentifier targetCommitIdentifier FROM %T c LEFT JOIN %T p ON c.pathID = p.id - LEFT JOIN %T t on c.targetPathID = t.id + LEFT JOIN %T t ON c.targetPathID = t.id + LEFT JOIN %T i ON c.targetCommitID = i.id WHERE c.commitID = %d AND isDirect = 1', PhabricatorRepository::TABLE_PATHCHANGE, PhabricatorRepository::TABLE_PATH, PhabricatorRepository::TABLE_PATH, + $commit->getTableName(), $commit->getID()); $changes = array(); - - - $raw_changes = isort($raw_changes, 'pathName'); foreach ($raw_changes as $raw_change) { $type = $raw_change['changeType']; @@ -76,9 +76,28 @@ class DiffusionPathChangeQuery { $change->setChangeType($raw_change['changeType']); $change->setFileType($raw_change['fileType']); $change->setCommitIdentifier($commit->getCommitIdentifier()); + + $change->setTargetPath(ltrim($raw_change['targetPathName'], '/')); + $change->setTargetCommitIdentifier($raw_change['targetCommitIdentifier']); + $changes[] = $change; } + // Deduce the away paths by examining all the changes. + + $away = array(); + foreach ($changes as $change) { + if ($change->getTargetPath()) { + $away[$change->getTargetPath()][] = $change->getPath(); + } + } + foreach ($changes as $change) { + if (isset($away[$change->getPath()])) { + $change->setAwayPaths($away[$change->getPath()]); + } + } + + return $changes; } }