mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40:55 +01:00
Fix SVN commit change parser for files moved from deleted directory
Summary: This is not perfect. Moved files are reported as deleted but I'm happy with it. Test Plan: Reparsed two commits which was previously wrong, now semi-correct. Reviewers: epriestley Reviewed By: epriestley CC: aran Maniphest Tasks: T1114 Differential Revision: https://secure.phabricator.com/D2215
This commit is contained in:
parent
9a29107d01
commit
17b0277ec5
1 changed files with 35 additions and 24 deletions
|
@ -159,33 +159,43 @@ class PhabricatorRepositorySvnCommitChangeParserWorker
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$type = DifferentialChangeType::TYPE_DELETE;
|
$type = DifferentialChangeType::TYPE_DELETE;
|
||||||
$file_type = $path_file_types[$path];
|
}
|
||||||
|
$file_type = $path_file_types[$path];
|
||||||
|
|
||||||
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
||||||
// Bad. Child paths aren't enumerated in "svn log" so we need
|
// Bad. Child paths aren't enumerated in "svn log" so we need
|
||||||
// to go fishing.
|
// to go fishing.
|
||||||
|
|
||||||
$list = $this->lookupRecursiveFileList(
|
$list = $this->lookupRecursiveFileList(
|
||||||
$repository,
|
$repository,
|
||||||
$lookup[$path]);
|
$lookup[$path]);
|
||||||
|
|
||||||
foreach ($list as $deleted_path => $path_file_type) {
|
foreach ($list as $deleted_path => $path_file_type) {
|
||||||
$deleted_path = rtrim($path.'/'.$deleted_path, '/');
|
$deleted_path = rtrim($path.'/'.$deleted_path, '/');
|
||||||
if (!empty($raw_paths[$deleted_path])) {
|
if (!empty($raw_paths[$deleted_path])) {
|
||||||
// We somehow learned about this deletion explicitly?
|
// We somehow learned about this deletion explicitly?
|
||||||
// TODO: Unclear how this is possible.
|
// TODO: Unclear how this is possible.
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
$effects[$deleted_path] = array(
|
|
||||||
'rawPath' => $deleted_path,
|
|
||||||
'rawTargetPath' => null,
|
|
||||||
'rawTargetCommit' => null,
|
|
||||||
'rawDirect' => true,
|
|
||||||
|
|
||||||
'changeType' => $type,
|
|
||||||
'fileType' => $path_file_type,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
$effect_type = $type;
|
||||||
|
$effect_target_path = null;
|
||||||
|
if (isset($copied_or_moved_map[$deleted_path])) {
|
||||||
|
$effect_target_path = $path;
|
||||||
|
if (count($copied_or_moved_map[$deleted_path]) > 1) {
|
||||||
|
$effect_type = DifferentialChangeType::TYPE_MULTICOPY;
|
||||||
|
} else {
|
||||||
|
$effect_type = DifferentialChangeType::TYPE_MOVE_AWAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$effects[$deleted_path] = array(
|
||||||
|
'rawPath' => $deleted_path,
|
||||||
|
'rawTargetPath' => $effect_target_path,
|
||||||
|
'rawTargetCommit' => null,
|
||||||
|
'rawDirect' => true,
|
||||||
|
|
||||||
|
'changeType' => $effect_type,
|
||||||
|
'fileType' => $path_file_type,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -217,7 +227,8 @@ class PhabricatorRepositorySvnCommitChangeParserWorker
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($source_file_type != DifferentialChangeType::FILE_DIRECTORY) {
|
if ($source_file_type != DifferentialChangeType::FILE_DIRECTORY) {
|
||||||
if (isset($raw_paths[$copy_from])) {
|
if (isset($raw_paths[$copy_from]) ||
|
||||||
|
isset($effects[$copy_from])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$effects[$copy_from] = array(
|
$effects[$copy_from] = array(
|
||||||
|
|
Loading…
Reference in a new issue