comparison tests/test_push_dirs.py @ 268:6ec5b5fc5b4d

Added a test case for directory-add behavior when repo root is not project root.
author Augie Fackler <durin42@gmail.com>
date Tue, 14 Apr 2009 22:44:19 -0500
parents 05a0c4f6060f
children 067914ecb4eb
comparison
equal deleted inserted replaced
267:f000b2392fc2 268:6ec5b5fc5b4d
20 ('d31/d32/d33/d34/a', 'd31/d32/d33/d34/a', 'a\n'), 20 ('d31/d32/d33/d34/a', 'd31/d32/d33/d34/a', 'a\n'),
21 ('d31/d32/a', 'd31/d32/a', 'a\n'), 21 ('d31/d32/a', 'd31/d32/a', 'a\n'),
22 ] 22 ]
23 self.commitchanges(changes) 23 self.commitchanges(changes)
24 self.pushrevisions() 24 self.pushrevisions()
25 self.assertEqual(self.svnls('trunk'), 25 self.assertEqual(self.svnls('trunk'),
26 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31', 26 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31',
27 'd31/d32', 'd31/d32/a', 'd31/d32/d33', 27 'd31/d32', 'd31/d32/a', 'd31/d32/d33',
28 'd31/d32/d33/d34', 'd31/d32/d33/d34/a']) 28 'd31/d32/d33/d34', 'd31/d32/d33/d34/a'])
29 29
30 # Add one revision with changed files only, no directory addition 30 # Add one revision with changed files only, no directory addition
31 # or deletion. 31 # or deletion.
32 changes = [ 32 changes = [
44 # Removing this file should remove one empty parent dir too 44 # Removing this file should remove one empty parent dir too
45 ('d31/d32/d33/d34/a', None, None), 45 ('d31/d32/d33/d34/a', None, None),
46 ] 46 ]
47 self.commitchanges(changes) 47 self.commitchanges(changes)
48 self.pushrevisions() 48 self.pushrevisions()
49 self.assertEqual(self.svnls('trunk'), 49 self.assertEqual(self.svnls('trunk'),
50 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', 'd31/d32/d33']) 50 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', 'd31/d32/d33'])
51
52
53 class TestPushDirsNotAtRoot(test_util.TestBase):
54 def test_push_new_dir_project_root_not_repo_root(self):
55 test_util.load_fixture_and_fetch('fetch_missing_files_subdir.svndump',
56 self.repo_path,
57 self.wc_path,
58 subdir='foo')
59 changes = [('magic_new/a', 'magic_new/a', 'ohai', ),
60 ]
61 self.commitchanges(changes)
62 self.pushrevisions()
63 self.assertEqual(self.svnls('foo/trunk'), ['bar',
64 'bar/alpha',
65 'bar/beta',
66 'bar/delta',
67 'bar/gamma',
68 'foo',
69 'magic_new',
70 'magic_new/a'])
71
72 def test_push_new_file_existing_dir_root_not_repo_root(self):
73 test_util.load_fixture_and_fetch('empty_dir_in_trunk_not_repo_root.svndump',
74 self.repo_path,
75 self.wc_path,
76 subdir='project')
77 changes = [('narf/a', 'narf/a', 'ohai', ),
78 ]
79 self.commitchanges(changes)
80 self.assertEqual(self.svnls('project/trunk'), ['a',
81 'narf',])
82 self.pushrevisions()
83 self.assertEqual(self.svnls('project/trunk'), ['a',
84 'narf',
85 'narf/a'])
86 changes = [('narf/a', None, None, ),
87 ]
88 self.commitchanges(changes)
89 self.pushrevisions()
90 self.assertEqual(self.svnls('project/trunk'), ['a' ,])
91
51 92
52 def suite(): 93 def suite():
53 all = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories), 94 all = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories),
54 ] 95 ]
55 return unittest.TestSuite(all) 96 return unittest.TestSuite(all)