comparison tests/comprehensive/test_stupid_pull.py @ 1092:cd0d14e25757

layouts: add custom layout for those of us that need weird mappings This adds a config-driven custom layout, targeted at the case where you need to fetch a small subset of a large number of subversion branches, or where your subversion layout doesn't match the standard trunk/branches/tags layout very well.
author David Schleimer <dschleimer@fb.com>
date Mon, 26 Aug 2013 16:40:31 -0700
parents cd256960b622
children ff4e102932ed
comparison
equal deleted inserted replaced
1091:384eb7e05b61 1092:cd0d14e25757
17 from hgsubversion import wrappers 17 from hgsubversion import wrappers
18 18
19 19
20 def _do_case(self, name, layout): 20 def _do_case(self, name, layout):
21 subdir = test_util.subdir.get(name, '') 21 subdir = test_util.subdir.get(name, '')
22 repo, repo_path = self.load_and_fetch(name, subdir=subdir, layout=layout) 22 config = {}
23 u = ui.ui()
24 for branch, path in test_util.custom.get(name, {}).iteritems():
25 config['hgsubversionbranch.%s' % branch] = path
26 u.setconfig('hgsubversionbranch', branch, path)
27 repo, repo_path = self.load_and_fetch(name,
28 subdir=subdir,
29 layout=layout,
30 config=config)
23 assert test_util.repolen(self.repo) > 0, \ 31 assert test_util.repolen(self.repo) > 0, \
24 'Repo had no changes, maybe you need to add a subdir entry in test_util?' 32 'Repo had no changes, maybe you need to add a subdir entry in test_util?'
25 wc2_path = self.wc_path + '_stupid' 33 wc2_path = self.wc_path + '_stupid'
26 u = ui.ui()
27 checkout_path = repo_path 34 checkout_path = repo_path
28 if subdir: 35 if subdir:
29 checkout_path += '/' + subdir 36 checkout_path += '/' + subdir
30 u.setconfig('hgsubversion', 'stupid', '1') 37 u.setconfig('hgsubversion', 'stupid', '1')
31 u.setconfig('hgsubversion', 'layout', layout) 38 u.setconfig('hgsubversion', 'layout', layout)
50 name = 'test_' + case[:-len('.svndump')].replace('-', '_') 57 name = 'test_' + case[:-len('.svndump')].replace('-', '_')
51 # Automatic layout branchtag collision exposes a minor defect 58 # Automatic layout branchtag collision exposes a minor defect
52 # here, but since it isn't a regression we suppress the test case. 59 # here, but since it isn't a regression we suppress the test case.
53 if case != 'branchtagcollision.svndump': 60 if case != 'branchtagcollision.svndump':
54 attrs[name] = buildmethod(case, name, 'auto') 61 attrs[name] = buildmethod(case, name, 'auto')
55 name += '_single' 62 attrs[name + '_single'] = buildmethod(case, name + '_single', 'single')
56 attrs[name] = buildmethod(case, name, 'single') 63 if case in test_util.custom:
64 attrs[name + '_custom'] = buildmethod(case, name + '_custom', 'custom')
57 65
58 StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs) 66 StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs)