Mercurial > hgsubversion
comparison tests/test_util.py @ 866:20e73b5ab6f7
test_util: merge load_svndump_fixture() into TestBase
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Thu, 19 Apr 2012 18:29:28 +0200 |
parents | 04729f3a3d17 |
children | 50c13e01c7e3 |
comparison
equal
deleted
inserted
replaced
865:04729f3a3d17 | 866:20e73b5ab6f7 |
---|---|
156 u.setconfig('hgsubversion', 'stupid', bools[stupid]) | 156 u.setconfig('hgsubversion', 'stupid', bools[stupid]) |
157 u.setconfig('hgsubversion', 'layout', layout) | 157 u.setconfig('hgsubversion', 'layout', layout) |
158 u.setconfig('hgsubversion', 'startrev', startrev) | 158 u.setconfig('hgsubversion', 'startrev', startrev) |
159 return u | 159 return u |
160 | 160 |
161 def load_svndump_fixture(path, fixture_name): | |
162 '''Loads an svnadmin dump into a fresh repo at path, which should not | |
163 already exist. | |
164 ''' | |
165 if os.path.exists(path): rmtree(path) | |
166 subprocess.call(['svnadmin', 'create', path, ], | |
167 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
168 inp = open(os.path.join(FIXTURES, fixture_name)) | |
169 proc = subprocess.Popen(['svnadmin', 'load', path, ], stdin=inp, | |
170 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
171 proc.communicate() | |
172 | |
173 def dispatch(cmd): | 161 def dispatch(cmd): |
174 try: | 162 try: |
175 req = dispatchmod.request(cmd) | 163 req = dispatchmod.request(cmd) |
176 dispatchmod.dispatch(req) | 164 dispatchmod.dispatch(req) |
177 except AttributeError, e: | 165 except AttributeError, e: |
264 _verify_our_modules() | 252 _verify_our_modules() |
265 | 253 |
266 def ui(self, stupid=False, layout='auto'): | 254 def ui(self, stupid=False, layout='auto'): |
267 return testui(stupid, layout) | 255 return testui(stupid, layout) |
268 | 256 |
257 def load_svndump(self, fixture_name): | |
258 '''Loads an svnadmin dump into a fresh repo. Return the svn repo | |
259 path. | |
260 ''' | |
261 path = self.repo_path | |
262 if os.path.exists(path): | |
263 rmtree(path) | |
264 subprocess.call(['svnadmin', 'create', path,], | |
265 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
266 inp = open(os.path.join(FIXTURES, fixture_name)) | |
267 proc = subprocess.Popen(['svnadmin', 'load', path,], stdin=inp, | |
268 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
269 proc.communicate() | |
270 return path | |
271 | |
269 def _load_fixture_and_fetch(self, fixture_name, subdir=None, stupid=False, | 272 def _load_fixture_and_fetch(self, fixture_name, subdir=None, stupid=False, |
270 layout='auto', startrev=0, externals=None, | 273 layout='auto', startrev=0, externals=None, |
271 noupdate=True): | 274 noupdate=True): |
272 if layout == 'single': | 275 if layout == 'single': |
273 if subdir is None: | 276 if subdir is None: |
274 subdir = 'trunk' | 277 subdir = 'trunk' |
275 elif subdir is None: | 278 elif subdir is None: |
276 subdir = '' | 279 subdir = '' |
277 load_svndump_fixture(self.repo_path, fixture_name) | 280 repo_path = self.load_svndump(fixture_name) |
278 projectpath = self.repo_path | 281 projectpath = repo_path |
279 if subdir: | 282 if subdir: |
280 projectpath += '/' + subdir | 283 projectpath += '/' + subdir |
281 | 284 |
282 cmd = [ | 285 cmd = [ |
283 'clone', | 286 'clone', |