Mercurial > hgsubversion
comparison tests/comprehensive/test_stupid_pull.py @ 499:1fd3cfa47c5e
Support for single-directory clones.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Fri, 16 Oct 2009 23:33:41 -0400 |
| parents | 24a8471069c0 |
| children | 58f397523604 |
comparison
equal
deleted
inserted
replaced
| 498:990e07054f29 | 499:1fd3cfa47c5e |
|---|---|
| 7 | 7 |
| 8 from tests import test_util | 8 from tests import test_util |
| 9 from hgsubversion import wrappers | 9 from hgsubversion import wrappers |
| 10 | 10 |
| 11 | 11 |
| 12 def _do_case(self, name): | 12 def _do_case(self, name, layout): |
| 13 subdir = test_util.subdir.get(name, '') | 13 subdir = test_util.subdir.get(name, '') |
| 14 self._load_fixture_and_fetch(name, subdir=subdir, stupid=False) | 14 self._load_fixture_and_fetch(name, subdir=subdir, stupid=False, layout=layout) |
| 15 assert len(self.repo) > 0, 'Repo had no changes, maybe you need to add a subdir entry in test_util?' | 15 assert len(self.repo) > 0, 'Repo had no changes, maybe you need to add a subdir entry in test_util?' |
| 16 wc2_path = self.wc_path + '_stupid' | 16 wc2_path = self.wc_path + '_stupid' |
| 17 u = ui.ui() | 17 u = ui.ui() |
| 18 checkout_path = self.repo_path | 18 checkout_path = self.repo_path |
| 19 if subdir: | 19 if subdir: |
| 20 checkout_path += '/' + subdir | 20 checkout_path += '/' + subdir |
| 21 u.setconfig('hgsubversion', 'stupid', '1') | 21 u.setconfig('hgsubversion', 'stupid', '1') |
| 22 u.setconfig('hgsubversion', 'layout', layout) | |
| 22 hg.clone(u, test_util.fileurl(checkout_path), wc2_path, update=False) | 23 hg.clone(u, test_util.fileurl(checkout_path), wc2_path, update=False) |
| 24 if layout == 'single': | |
| 25 self.assertEqual(len(self.repo.heads()), 1) | |
| 23 self.repo2 = hg.repository(ui.ui(), wc2_path) | 26 self.repo2 = hg.repository(ui.ui(), wc2_path) |
| 24 self.assertEqual(self.repo.heads(), self.repo2.heads()) | 27 self.assertEqual(self.repo.heads(), self.repo2.heads()) |
| 25 | 28 |
| 26 | 29 |
| 27 def buildmethod(case, name): | 30 def buildmethod(case, name, layout): |
| 28 m = lambda self: self._do_case(case) | 31 m = lambda self: self._do_case(case, layout) |
| 29 m.__name__ = name | 32 m.__name__ = name |
| 30 m.__doc__ = 'Test stupid produces same as real on %s.' % case | 33 m.__doc__ = 'Test stupid produces same as real on %s. (%s)' % (case, layout) |
| 31 return m | 34 return m |
| 32 | 35 |
| 33 attrs = {'_do_case': _do_case, | 36 attrs = {'_do_case': _do_case, |
| 34 } | 37 } |
| 35 for case in (f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')): | 38 for case in (f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')): |
| 36 name = 'test_' + case[:-len('.svndump')] | 39 name = 'test_' + case[:-len('.svndump')] |
| 37 attrs[name] = buildmethod(case, name) | 40 attrs[name] = buildmethod(case, name, 'auto') |
| 41 name += '_single' | |
| 42 attrs[name] = buildmethod(case, name, 'single') | |
| 43 | |
| 38 StupidPullTests = type('StupidPullTests', (test_util.TestBase, ), attrs) | 44 StupidPullTests = type('StupidPullTests', (test_util.TestBase, ), attrs) |
| 39 | 45 |
| 40 | 46 |
| 41 def suite(): | 47 def suite(): |
| 42 all = [unittest.TestLoader().loadTestsFromTestCase(StupidPullTests), | 48 all = [unittest.TestLoader().loadTestsFromTestCase(StupidPullTests), |
