comparison tests/test_util.py @ 706:1f1a3a6730c1

test_util: use the Mercurial dispatch logic for cloning repositories. This makes our test environment more similar to deployment environments.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 24 Sep 2010 22:11:24 +0200
parents c11bf0dd38d3
children cfc7df19e4dc
comparison
equal deleted inserted replaced
705:385213d2e2da 706:1f1a3a6730c1
15 _rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 15 _rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16 sys.path.insert(0, _rootdir) 16 sys.path.insert(0, _rootdir)
17 17
18 from mercurial import commands 18 from mercurial import commands
19 from mercurial import context 19 from mercurial import context
20 from mercurial import dispatch
20 from mercurial import hg 21 from mercurial import hg
21 from mercurial import i18n 22 from mercurial import i18n
22 from mercurial import node 23 from mercurial import node
23 from mercurial import ui 24 from mercurial import ui
24 from mercurial import extensions 25 from mercurial import extensions
124 subdir='', noupdate=True, layout='auto', 125 subdir='', noupdate=True, layout='auto',
125 startrev=0): 126 startrev=0):
126 load_svndump_fixture(repo_path, fixture_name) 127 load_svndump_fixture(repo_path, fixture_name)
127 if subdir: 128 if subdir:
128 repo_path += '/' + subdir 129 repo_path += '/' + subdir
129 _ui = testui(stupid=stupid, layout=layout, startrev=startrev) 130
130 commands.clone(_ui, fileurl(repo_path), wc_path, noupdate=noupdate) 131 cmd = [
132 'clone',
133 '--layout=%s' % layout,
134 '--startrev=%s' % startrev,
135 fileurl(repo_path),
136 wc_path,
137 ]
138 if stupid:
139 cmd.append('--stupid')
140 if noupdate:
141 cmd.append('--noupdate')
142
143 dispatch.dispatch(cmd)
144
131 return hg.repository(testui(), wc_path) 145 return hg.repository(testui(), wc_path)
132 146
133 def rmtree(path): 147 def rmtree(path):
134 # Read-only files cannot be removed under Windows 148 # Read-only files cannot be removed under Windows
135 for root, dirs, files in os.walk(path): 149 for root, dirs, files in os.walk(path):