Mercurial > hgsubversion
diff 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 |
line wrap: on
line diff
--- a/tests/test_externals.py +++ b/tests/test_externals.py @@ -81,7 +81,58 @@ class TestFetchExternals(test_util.TestB def test_externals_stupid(self): self.test_externals(True) + +class TestPushExternals(test_util.TestBase): + def setUp(self): + test_util.TestBase.setUp(self) + test_util.load_fixture_and_fetch('pushexternals.svndump', + self.repo_path, + self.wc_path) + + def test_push_externals(self, stupid=False): + # Add a new reference on an existing and non-existing directory + changes = [ + ('.hgsvnexternals', '.hgsvnexternals', + """\ +[dir] + ../externals/project2 deps/project2 +[subdir1] + ../externals/project1 deps/project1 +[subdir2] + ../externals/project2 deps/project2 +"""), + ('subdir1/a', 'subdir1/a', 'a'), + ('subdir2/a', 'subdir2/a', 'a'), + ] + self.commitchanges(changes) + self.pushrevisions(stupid) + self.assertchanges(changes, self.repo['tip']) + + # Remove all references from one directory, add a new one + # to the other (test multiline entries) + changes = [ + ('.hgsvnexternals', '.hgsvnexternals', + """\ +[subdir1] + ../externals/project1 deps/project1 + ../externals/project2 deps/project2 +"""), + # This removal used to trigger the parent directory removal + ('subdir1/a', None, None), + ] + self.commitchanges(changes) + self.pushrevisions(stupid) + self.assertchanges(changes, self.repo['tip']) + # Check subdir2/a is still there even if the externals were removed + self.assertTrue('subdir2/a' in self.repo['tip']) + self.assertTrue('subdir1/a' not in self.repo['tip']) + + def test_push_externals_stupid(self): + self.test_push_externals(True) + + def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals), + unittest.TestLoader().loadTestsFromTestCase(TestPushExternals), ] return unittest.TestSuite(all)