comparison tests/test_externals.py @ 175:2412800b1258

Support svn:externals changes via .hgsvnexternals updates
author Patrick Mezard <pmezard@gmail.com>
date Fri, 02 Jan 2009 15:54:05 -0600
parents f80132c5fea5
children c4115b3918e9
comparison
equal deleted inserted replaced
174:f80132c5fea5 175:2412800b1258
79 self.assertEqual(ref4, repo[4]['.hgsvnexternals'].data()) 79 self.assertEqual(ref4, repo[4]['.hgsvnexternals'].data())
80 80
81 def test_externals_stupid(self): 81 def test_externals_stupid(self):
82 self.test_externals(True) 82 self.test_externals(True)
83 83
84
85 class TestPushExternals(test_util.TestBase):
86 def setUp(self):
87 test_util.TestBase.setUp(self)
88 test_util.load_fixture_and_fetch('pushexternals.svndump',
89 self.repo_path,
90 self.wc_path)
91
92 def test_push_externals(self, stupid=False):
93 # Add a new reference on an existing and non-existing directory
94 changes = [
95 ('.hgsvnexternals', '.hgsvnexternals',
96 """\
97 [dir]
98 ../externals/project2 deps/project2
99 [subdir1]
100 ../externals/project1 deps/project1
101 [subdir2]
102 ../externals/project2 deps/project2
103 """),
104 ('subdir1/a', 'subdir1/a', 'a'),
105 ('subdir2/a', 'subdir2/a', 'a'),
106 ]
107 self.commitchanges(changes)
108 self.pushrevisions(stupid)
109 self.assertchanges(changes, self.repo['tip'])
110
111 # Remove all references from one directory, add a new one
112 # to the other (test multiline entries)
113 changes = [
114 ('.hgsvnexternals', '.hgsvnexternals',
115 """\
116 [subdir1]
117 ../externals/project1 deps/project1
118 ../externals/project2 deps/project2
119 """),
120 # This removal used to trigger the parent directory removal
121 ('subdir1/a', None, None),
122 ]
123 self.commitchanges(changes)
124 self.pushrevisions(stupid)
125 self.assertchanges(changes, self.repo['tip'])
126 # Check subdir2/a is still there even if the externals were removed
127 self.assertTrue('subdir2/a' in self.repo['tip'])
128 self.assertTrue('subdir1/a' not in self.repo['tip'])
129
130 def test_push_externals_stupid(self):
131 self.test_push_externals(True)
132
133
84 def suite(): 134 def suite():
85 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals), 135 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals),
136 unittest.TestLoader().loadTestsFromTestCase(TestPushExternals),
86 ] 137 ]
87 return unittest.TestSuite(all) 138 return unittest.TestSuite(all)