comparison tests/test_util.py @ 813:f07bfd66db13

test_util: handle dispatch.dispatch() taking a request This was introduced in hg.08bfec2ef031
author Patrick Mezard <pmezard@gmail.com>
date Wed, 15 Jun 2011 14:44:14 +0200
parents e698be84c22d
children 86d124a8768e
comparison
equal deleted inserted replaced
812:8c7447b4b004 813:f07bfd66db13
16 sys.path.insert(0, _rootdir) 16 sys.path.insert(0, _rootdir)
17 17
18 from mercurial import cmdutil 18 from mercurial import cmdutil
19 from mercurial import commands 19 from mercurial import commands
20 from mercurial import context 20 from mercurial import context
21 from mercurial import dispatch 21 from mercurial import dispatch as dispatchmod
22 from mercurial import hg 22 from mercurial import hg
23 from mercurial import i18n 23 from mercurial import i18n
24 from mercurial import node 24 from mercurial import node
25 from mercurial import ui 25 from mercurial import ui
26 from mercurial import util 26 from mercurial import util
168 inp = open(os.path.join(FIXTURES, fixture_name)) 168 inp = open(os.path.join(FIXTURES, fixture_name))
169 proc = subprocess.Popen(['svnadmin', 'load', path,], stdin=inp, 169 proc = subprocess.Popen(['svnadmin', 'load', path,], stdin=inp,
170 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 170 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
171 proc.communicate() 171 proc.communicate()
172 172
173 def dispatch(cmd):
174 try:
175 req = dispatchmod.request(cmd)
176 dispatchmod.dispatch(req)
177 except AttributeError, e:
178 dispatchmod.dispatch(cmd)
179
173 def load_fixture_and_fetch(fixture_name, repo_path, wc_path, stupid=False, 180 def load_fixture_and_fetch(fixture_name, repo_path, wc_path, stupid=False,
174 subdir='', noupdate=True, layout='auto', 181 subdir='', noupdate=True, layout='auto',
175 startrev=0, externals=None): 182 startrev=0, externals=None):
176 load_svndump_fixture(repo_path, fixture_name) 183 load_svndump_fixture(repo_path, fixture_name)
177 if subdir: 184 if subdir:
189 if noupdate: 196 if noupdate:
190 cmd.append('--noupdate') 197 cmd.append('--noupdate')
191 if externals: 198 if externals:
192 cmd[:0] = ['--config', 'hgsubversion.externals=%s' % externals] 199 cmd[:0] = ['--config', 'hgsubversion.externals=%s' % externals]
193 200
194 dispatch.dispatch(cmd) 201 dispatch(cmd)
195 202
196 return hg.repository(testui(), wc_path) 203 return hg.repository(testui(), wc_path)
197 204
198 def rmtree(path): 205 def rmtree(path):
199 # Read-only files cannot be removed under Windows 206 # Read-only files cannot be removed under Windows