Mercurial > hgsubversion
comparison tests/test_util.py @ 871:51fd75ae62b9
test_util: pass repo_path to svnpropget(), turn into a function
| author | Patrick Mezard <patrick@mezard.eu> |
|---|---|
| date | Thu, 19 Apr 2012 18:29:31 +0200 |
| parents | 1eb2a4428c42 |
| children | a279b5838aaf |
comparison
equal
deleted
inserted
replaced
| 870:1eb2a4428c42 | 871:51fd75ae62b9 |
|---|---|
| 219 raise Exception('svn ls failed on %s: %r' % (path, stderr)) | 219 raise Exception('svn ls failed on %s: %r' % (path, stderr)) |
| 220 entries = [e.strip('/') for e in stdout.splitlines()] | 220 entries = [e.strip('/') for e in stdout.splitlines()] |
| 221 entries.sort() | 221 entries.sort() |
| 222 return entries | 222 return entries |
| 223 | 223 |
| 224 def svnpropget(repo_path, path, prop, rev='HEAD'): | |
| 225 path = repo_path + '/' + path | |
| 226 path = util.normalize_url(fileurl(path)) | |
| 227 args = ['svn', 'propget', '-r', str(rev), prop, path] | |
| 228 p = subprocess.Popen(args, | |
| 229 stdout=subprocess.PIPE, | |
| 230 stderr=subprocess.STDOUT) | |
| 231 stdout, stderr = p.communicate() | |
| 232 if p.returncode: | |
| 233 raise Exception('svn ls failed on %s: %r' % (path, stderr)) | |
| 234 return stdout.strip() | |
| 235 | |
| 224 class TestBase(unittest.TestCase): | 236 class TestBase(unittest.TestCase): |
| 225 def setUp(self): | 237 def setUp(self): |
| 226 _verify_our_modules() | 238 _verify_our_modules() |
| 227 | 239 |
| 228 self.oldenv = dict([(k, os.environ.get(k, None),) for k in | 240 self.oldenv = dict([(k, os.environ.get(k, None),) for k in |
| 364 stdout=subprocess.PIPE, | 376 stdout=subprocess.PIPE, |
| 365 stderr=subprocess.STDOUT) | 377 stderr=subprocess.STDOUT) |
| 366 stdout, stderr = p.communicate() | 378 stdout, stderr = p.communicate() |
| 367 if p.returncode: | 379 if p.returncode: |
| 368 raise Exception('svn co failed on %s: %r' % (svnpath, stderr)) | 380 raise Exception('svn co failed on %s: %r' % (svnpath, stderr)) |
| 369 | |
| 370 def svnpropget(self, path, prop, rev='HEAD'): | |
| 371 path = self.repo_path + '/' + path | |
| 372 path = util.normalize_url(fileurl(path)) | |
| 373 args = ['svn', 'propget', '-r', str(rev), prop, path] | |
| 374 p = subprocess.Popen(args, | |
| 375 stdout=subprocess.PIPE, | |
| 376 stderr=subprocess.STDOUT) | |
| 377 stdout, stderr = p.communicate() | |
| 378 if p.returncode: | |
| 379 raise Exception('svn ls failed on %s: %r' % (path, stderr)) | |
| 380 return stdout.strip() | |
| 381 | 381 |
| 382 def commitchanges(self, changes, parent='tip', message='automated test'): | 382 def commitchanges(self, changes, parent='tip', message='automated test'): |
| 383 """Commit changes to mercurial directory | 383 """Commit changes to mercurial directory |
| 384 | 384 |
| 385 'changes' is a sequence of tuples (source, dest, data). It can look | 385 'changes' is a sequence of tuples (source, dest, data). It can look |
