comparison tests/comprehensive/test_updatemeta.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 48379ebd2763
children c6b01fd34694
comparison
equal deleted inserted replaced
1091:384eb7e05b61 1092:cd0d14e25757
21 from hgsubversion import svncommands 21 from hgsubversion import svncommands
22 from hgsubversion import svnmeta 22 from hgsubversion import svnmeta
23 23
24 24
25 25
26 def _do_case(self, name, single): 26 def _do_case(self, name, layout):
27 subdir = test_util.subdir.get(name, '') 27 subdir = test_util.subdir.get(name, '')
28 layout = 'auto' 28 single = layout == 'single'
29 if single: 29 u = ui.ui()
30 layout = 'single' 30 config = {}
31 repo, repo_path = self.load_and_fetch(name, subdir=subdir, layout=layout) 31 if layout == 'custom':
32 config['hgsubversion.layout'] = 'custom'
33 u.setconfig('hgsubversion', 'layout', 'custom')
34 for branch, path in test_util.custom.get(name, {}).iteritems():
35 config['hgsubversionbranch.%s' % branch] = path
36 u.setconfig('hgsubversionbranch', branch, path)
37
38 repo, repo_path = self.load_and_fetch(name,
39 subdir=subdir,
40 layout=layout,
41 config=config)
32 assert test_util.repolen(self.repo) > 0 42 assert test_util.repolen(self.repo) > 0
33 wc2_path = self.wc_path + '_clone' 43 wc2_path = self.wc_path + '_clone'
34 u = ui.ui()
35 src, dest = test_util.hgclone(u, self.wc_path, wc2_path, update=False) 44 src, dest = test_util.hgclone(u, self.wc_path, wc2_path, update=False)
36 src = test_util.getlocalpeer(src) 45 src = test_util.getlocalpeer(src)
37 dest = test_util.getlocalpeer(dest) 46 dest = test_util.getlocalpeer(dest)
38 47
39 # insert a wrapper that prevents calling changectx.children() 48 # insert a wrapper that prevents calling changectx.children()
72 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]: 81 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
73 # this fixture results in an empty repository, don't use it 82 # this fixture results in an empty repository, don't use it
74 if case in skip: 83 if case in skip:
75 continue 84 continue
76 bname = 'test_' + case[:-len('.svndump')] 85 bname = 'test_' + case[:-len('.svndump')]
77 attrs[bname] = test_rebuildmeta.buildmethod(case, bname, False) 86 attrs[bname] = test_rebuildmeta.buildmethod(case, bname, 'auto')
78 name = bname + '_single' 87 attrs[bname + '_single'] = test_rebuildmeta.buildmethod(case,
79 attrs[name] = test_rebuildmeta.buildmethod(case, name, True) 88 bname + '_single',
89 'single')
90 if case in test_util.custom:
91 attrs[bname + '_custom'] = test_rebuildmeta.buildmethod(case,
92 bname + '_custom',
93 'custom')
94
80 95
81 UpdateMetaTests = type('UpdateMetaTests', (test_util.TestBase,), attrs) 96 UpdateMetaTests = type('UpdateMetaTests', (test_util.TestBase,), attrs)