Mercurial > hgsubversion
comparison tests/test_push_dirs.py @ 869:db3a651494f9
test_util: pass repo_path to svnls(), turn it into a function
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Thu, 19 Apr 2012 18:29:30 +0200 |
parents | 312b37bc5e20 |
children | d741f536f23a |
comparison
equal
deleted
inserted
replaced
868:cc1c870f1758 | 869:db3a651494f9 |
---|---|
2 | 2 |
3 import unittest | 3 import unittest |
4 | 4 |
5 class TestPushDirectories(test_util.TestBase): | 5 class TestPushDirectories(test_util.TestBase): |
6 def test_push_dirs(self): | 6 def test_push_dirs(self): |
7 self._load_fixture_and_fetch('emptyrepo.svndump') | 7 repo_path = self.load_and_fetch('emptyrepo.svndump')[1] |
8 | 8 |
9 changes = [ | 9 changes = [ |
10 # Single file in single directory | 10 # Single file in single directory |
11 ('d1/a', 'd1/a', 'a\n'), | 11 ('d1/a', 'd1/a', 'a\n'), |
12 # Two files in one directory | 12 # Two files in one directory |
16 ('d31/d32/d33/d34/a', 'd31/d32/d33/d34/a', 'a\n'), | 16 ('d31/d32/d33/d34/a', 'd31/d32/d33/d34/a', 'a\n'), |
17 ('d31/d32/a', 'd31/d32/a', 'a\n'), | 17 ('d31/d32/a', 'd31/d32/a', 'a\n'), |
18 ] | 18 ] |
19 self.commitchanges(changes) | 19 self.commitchanges(changes) |
20 self.pushrevisions() | 20 self.pushrevisions() |
21 self.assertEqual(self.svnls('trunk'), | 21 self.assertEqual(test_util.svnls(repo_path, 'trunk'), |
22 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31', | 22 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31', |
23 'd31/d32', 'd31/d32/a', 'd31/d32/d33', | 23 'd31/d32', 'd31/d32/a', 'd31/d32/d33', |
24 'd31/d32/d33/d34', 'd31/d32/d33/d34/a']) | 24 'd31/d32/d33/d34', 'd31/d32/d33/d34/a']) |
25 | 25 |
26 # Add one revision with changed files only, no directory addition | 26 # Add one revision with changed files only, no directory addition |
40 # Removing this file should remove one empty parent dir too | 40 # Removing this file should remove one empty parent dir too |
41 ('d31/d32/d33/d34/a', None, None), | 41 ('d31/d32/d33/d34/a', None, None), |
42 ] | 42 ] |
43 self.commitchanges(changes) | 43 self.commitchanges(changes) |
44 self.pushrevisions() | 44 self.pushrevisions() |
45 self.assertEqual(self.svnls('trunk'), | 45 self.assertEqual(test_util.svnls(repo_path, 'trunk'), |
46 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', ]) | 46 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', ]) |
47 | 47 |
48 def test_push_new_dir_project_root_not_repo_root(self): | 48 def test_push_new_dir_project_root_not_repo_root(self): |
49 self._load_fixture_and_fetch('fetch_missing_files_subdir.svndump', | 49 repo_path = self.load_and_fetch('fetch_missing_files_subdir.svndump', |
50 subdir='foo') | 50 subdir='foo')[1] |
51 changes = [('magic_new/a', 'magic_new/a', 'ohai',), | 51 changes = [('magic_new/a', 'magic_new/a', 'ohai',), |
52 ] | 52 ] |
53 self.commitchanges(changes) | 53 self.commitchanges(changes) |
54 self.pushrevisions() | 54 self.pushrevisions() |
55 self.assertEqual(self.svnls('foo/trunk'), ['bar', | 55 self.assertEqual(test_util.svnls(repo_path, 'foo/trunk'), ['bar', |
56 'bar/alpha', | 56 'bar/alpha', |
57 'bar/beta', | 57 'bar/beta', |
58 'bar/delta', | 58 'bar/delta', |
59 'bar/gamma', | 59 'bar/gamma', |
60 'foo', | 60 'foo', |
61 'magic_new', | 61 'magic_new', |
62 'magic_new/a']) | 62 'magic_new/a']) |
63 | 63 |
64 def test_push_new_file_existing_dir_root_not_repo_root(self): | 64 def test_push_new_file_existing_dir_root_not_repo_root(self): |
65 self._load_fixture_and_fetch('empty_dir_in_trunk_not_repo_root.svndump', | 65 repo_path = self.load_and_fetch('empty_dir_in_trunk_not_repo_root.svndump', |
66 subdir='project') | 66 subdir='project')[1] |
67 changes = [('narf/a', 'narf/a', 'ohai',), | 67 changes = [('narf/a', 'narf/a', 'ohai',), |
68 ] | 68 ] |
69 self.commitchanges(changes) | 69 self.commitchanges(changes) |
70 self.assertEqual(self.svnls('project/trunk'), ['a', | 70 self.assertEqual(test_util.svnls(repo_path, 'project/trunk'), ['a', |
71 'narf', | 71 'narf', |
72 ]) | 72 ]) |
73 self.pushrevisions() | 73 self.pushrevisions() |
74 self.assertEqual(self.svnls('project/trunk'), ['a', | 74 self.assertEqual(test_util.svnls(repo_path, 'project/trunk'), ['a', |
75 'narf', | 75 'narf', |
76 'narf/a']) | 76 'narf/a']) |
77 changes = [('narf/a', None, None,), | 77 changes = [('narf/a', None, None,), |
78 ] | 78 ] |
79 self.commitchanges(changes) | 79 self.commitchanges(changes) |
80 self.pushrevisions() | 80 self.pushrevisions() |
81 self.assertEqual(self.svnls('project/trunk'), ['a']) | 81 self.assertEqual(test_util.svnls(repo_path, 'project/trunk'), ['a']) |
82 | 82 |
83 def test_push_single_dir_change_in_subdir(self): | 83 def test_push_single_dir_change_in_subdir(self): |
84 # Tests simple pushing from default branch to a single dir repo | 84 # Tests simple pushing from default branch to a single dir repo |
85 # Changes a file in a subdir (regression). | 85 # Changes a file in a subdir (regression). |
86 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', | 86 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', |
87 stupid=False, | 87 stupid=False, |
88 layout='single', | 88 layout='single', |
89 subdir='tags') | 89 subdir='tags') |
90 changes = [('tag_r3/alpha', 'tag_r3/alpha', 'foo'), | 90 changes = [('tag_r3/alpha', 'tag_r3/alpha', 'foo'), |
91 ('tag_r3/new', 'tag_r3/new', 'foo'), | 91 ('tag_r3/new', 'tag_r3/new', 'foo'), |
92 ('new_dir/new', 'new_dir/new', 'foo'), | 92 ('new_dir/new', 'new_dir/new', 'foo'), |
93 ] | 93 ] |
94 self.commitchanges(changes) | 94 self.commitchanges(changes) |
95 self.pushrevisions() | 95 self.pushrevisions() |
96 self.assertEqual(self.svnls('tags'), | 96 self.assertEqual(test_util.svnls(repo_path, 'tags'), |
97 ['copied_tag', | 97 ['copied_tag', |
98 'copied_tag/alpha', | 98 'copied_tag/alpha', |
99 'copied_tag/beta', | 99 'copied_tag/beta', |
100 'new_dir', | 100 'new_dir', |
101 'new_dir/new', | 101 'new_dir/new', |