comparison tests/test_util.py @ 869:db3a651494f9

test_util: pass repo_path to svnls(), turn it into a function
author Patrick Mezard <patrick@mezard.eu>
date Thu, 19 Apr 2012 18:29:30 +0200
parents cc1c870f1758
children 1eb2a4428c42
comparison
equal deleted inserted replaced
868:cc1c870f1758 869:db3a651494f9
205 src, dest = hg.clone(ui, {}, source, dest, update=update) 205 src, dest = hg.clone(ui, {}, source, dest, update=update)
206 else: 206 else:
207 src, dest = hg.clone(ui, source, dest, update=update) 207 src, dest = hg.clone(ui, source, dest, update=update)
208 return src, dest 208 return src, dest
209 209
210 def svnls(repo_path, path, rev='HEAD'):
211 path = repo_path + '/' + path
212 path = util.normalize_url(fileurl(path))
213 args = ['svn', 'ls', '-r', rev, '-R', path]
214 p = subprocess.Popen(args,
215 stdout=subprocess.PIPE,
216 stderr=subprocess.STDOUT)
217 stdout, stderr = p.communicate()
218 if p.returncode:
219 raise Exception('svn ls failed on %s: %r' % (path, stderr))
220 entries = [e.strip('/') for e in stdout.splitlines()]
221 entries.sort()
222 return entries
223
210 class TestBase(unittest.TestCase): 224 class TestBase(unittest.TestCase):
211 def setUp(self): 225 def setUp(self):
212 _verify_our_modules() 226 _verify_our_modules()
213 227
214 self.oldenv = dict([(k, os.environ.get(k, None),) for k in 228 self.oldenv = dict([(k, os.environ.get(k, None),) for k in
336 self.repo.ui.setconfig('hgsubversion', 'stupid', str(stupid)) 350 self.repo.ui.setconfig('hgsubversion', 'stupid', str(stupid))
337 res = commands.push(self.repo.ui, self.repo) 351 res = commands.push(self.repo.ui, self.repo)
338 after = len(self.repo) 352 after = len(self.repo)
339 self.assertEqual(expected_extra_back, after - before) 353 self.assertEqual(expected_extra_back, after - before)
340 return res 354 return res
341
342 def svnls(self, path, rev='HEAD'):
343 path = self.repo_path + '/' + path
344 path = util.normalize_url(fileurl(path))
345 args = ['svn', 'ls', '-r', rev, '-R', path]
346 p = subprocess.Popen(args,
347 stdout=subprocess.PIPE,
348 stderr=subprocess.STDOUT)
349 stdout, stderr = p.communicate()
350 if p.returncode:
351 raise Exception('svn ls failed on %s: %r' % (path, stderr))
352 entries = [e.strip('/') for e in stdout.splitlines()]
353 entries.sort()
354 return entries
355 355
356 def svnco(self, svnpath, rev, path): 356 def svnco(self, svnpath, rev, path):
357 path = os.path.join(self.wc_path, path) 357 path = os.path.join(self.wc_path, path)
358 subpath = os.path.dirname(path) 358 subpath = os.path.dirname(path)
359 if not os.path.isdir(subpath): 359 if not os.path.isdir(subpath):