1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Add more Subversion unit tests

Summary:
Ref T4327. Adds additional SVN tests to cover:

  - replacing a file with a file;
  - replacing a file with a directory;
  - removing a directory with files in it;
  - adding a directory with files;
  - copying a directory and adding and deleting files inside it.

Test Plan: Ran unit tests. One of these has a slightly irregular parse, see inline.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4327

Differential Revision: https://secure.phabricator.com/D8017
This commit is contained in:
epriestley 2014-01-21 14:02:32 -08:00
parent a9612fac24
commit 9dde415884
3 changed files with 275 additions and 1 deletions

View file

@ -406,6 +406,280 @@ final class PhabricatorChangeParserTestCase
$repository, $repository,
$commits, $commits,
array( array(
// Copy a directory, removing and adding files to the copy
'12' => array(
array(
'/',
null,
null,
DifferentialChangeType::TYPE_CHILD,
DifferentialChangeType::FILE_DIRECTORY,
0,
12,
),
array(
'/dir',
null,
null,
// TODO: This might reasonbly be considered a bug in the parser; it
// should probably be COPY_AWAY.
DifferentialChangeType::TYPE_CHILD,
DifferentialChangeType::FILE_DIRECTORY,
0,
12,
),
array(
'/dir/a',
null,
null,
DifferentialChangeType::TYPE_COPY_AWAY,
DifferentialChangeType::FILE_NORMAL,
0,
12,
),
array(
'/dir/b',
null,
null,
DifferentialChangeType::TYPE_COPY_AWAY,
DifferentialChangeType::FILE_NORMAL,
0,
12,
),
array(
'/dir/subdir',
null,
null,
DifferentialChangeType::TYPE_COPY_AWAY,
DifferentialChangeType::FILE_DIRECTORY,
0,
12,
),
array(
'/dir/subdir/a',
null,
null,
DifferentialChangeType::TYPE_COPY_AWAY,
DifferentialChangeType::FILE_NORMAL,
0,
12,
),
array(
'/dir/subdir/b',
null,
null,
DifferentialChangeType::TYPE_COPY_AWAY,
DifferentialChangeType::FILE_NORMAL,
0,
12,
),
array(
'/dir_copy',
'/dir',
'11',
DifferentialChangeType::TYPE_COPY_HERE,
DifferentialChangeType::FILE_DIRECTORY,
1,
12,
),
array(
'/dir_copy/a',
'/dir/a',
'11',
DifferentialChangeType::TYPE_COPY_HERE,
DifferentialChangeType::FILE_NORMAL,
1,
12,
),
array(
'/dir_copy/b',
'/dir/b',
'11',
DifferentialChangeType::TYPE_COPY_HERE,
DifferentialChangeType::FILE_NORMAL,
1,
12,
),
array(
'/dir_copy/subdir',
'/dir/subdir',
'11',
DifferentialChangeType::TYPE_COPY_HERE,
DifferentialChangeType::FILE_DIRECTORY,
1,
12,
),
array(
'/dir_copy/subdir/a',
'/dir/subdir/a',
'11',
DifferentialChangeType::TYPE_COPY_HERE,
DifferentialChangeType::FILE_NORMAL,
1,
12,
),
array(
'/dir_copy/subdir/b',
'/dir/subdir/b',
'11',
DifferentialChangeType::TYPE_DELETE,
DifferentialChangeType::FILE_NORMAL,
1,
12,
),
array(
'/dir_copy/subdir/c',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_NORMAL,
1,
12,
),
),
// Add a directory with a subdirectory and files, sets up next commit
'11' => array(
array(
'/',
null,
null,
DifferentialChangeType::TYPE_CHILD,
DifferentialChangeType::FILE_DIRECTORY,
0,
11,
),
array(
'/dir',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_DIRECTORY,
1,
11,
),
array(
'/dir/a',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_NORMAL,
1,
11,
),
array(
'/dir/b',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_NORMAL,
1,
11,
),
array(
'/dir/subdir',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_DIRECTORY,
1,
11,
),
array(
'/dir/subdir/a',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_NORMAL,
1,
11,
),
array(
'/dir/subdir/b',
null,
null,
DifferentialChangeType::TYPE_ADD,
DifferentialChangeType::FILE_NORMAL,
1,
11,
),
),
// Remove directory
'10' => array(
array(
'/',
null,
null,
DifferentialChangeType::TYPE_CHILD,
DifferentialChangeType::FILE_DIRECTORY,
0,
10,
),
array(
'/dir',
null,
null,
DifferentialChangeType::TYPE_DELETE,
DifferentialChangeType::FILE_DIRECTORY,
1,
10,
),
array(
'/dir/subfile',
null,
null,
DifferentialChangeType::TYPE_DELETE,
DifferentialChangeType::FILE_NORMAL,
1,
10,
),
),
// Replace directory with file
'9' => array(
array(
'/',
null,
null,
DifferentialChangeType::TYPE_CHILD,
DifferentialChangeType::FILE_DIRECTORY,
0,
9,
),
array(
'/file_moved',
null,
null,
DifferentialChangeType::TYPE_CHANGE,
DifferentialChangeType::FILE_DIRECTORY,
1,
9,
),
),
// Replace file with file
'8' => array(
array(
'/',
null,
null,
DifferentialChangeType::TYPE_CHILD,
DifferentialChangeType::FILE_DIRECTORY,
0,
8,
),
array(
'/file_moved',
null,
null,
DifferentialChangeType::TYPE_CHANGE,
DifferentialChangeType::FILE_NORMAL,
1,
8,
),
),
'7' => array( '7' => array(
array( array(
'/', '/',

View file

@ -37,7 +37,7 @@ final class PhabricatorRepositorySvnCommitChangeParserWorker
// TODO: Explicitly mark this commit as broken elsewhere? This isn't // TODO: Explicitly mark this commit as broken elsewhere? This isn't
// supposed to happen but we have some cases like rE27 and rG935 in the // supposed to happen but we have some cases like rE27 and rG935 in the
// Facebook repositories where things got all clowned up. // Facebook repositories where things got all clowned up.
return; return array();
} }
$raw_paths = array(); $raw_paths = array();