Mercurial > hgsubversion
comparison tests/test_util.py @ 83:6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Fri, 14 Nov 2008 16:18:24 -0600 |
| parents | 71de43e9f614 |
| children | 01e747937d35 |
comparison
equal
deleted
inserted
replaced
| 82:71de43e9f614 | 83:6c9b7cf1c5aa |
|---|---|
| 69 self.wc_path = '%s/testrepo_wc' % self.tmpdir | 69 self.wc_path = '%s/testrepo_wc' % self.tmpdir |
| 70 | 70 |
| 71 def tearDown(self): | 71 def tearDown(self): |
| 72 rmtree(self.tmpdir) | 72 rmtree(self.tmpdir) |
| 73 os.chdir(self.oldwd) | 73 os.chdir(self.oldwd) |
| 74 | 74 |
| 75 # define this as a property so that it reloads anytime we need it | 75 # define this as a property so that it reloads anytime we need it |
| 76 @property | 76 @property |
| 77 def repo(self): | 77 def repo(self): |
| 78 return hg.repository(ui.ui(), self.wc_path) | 78 return hg.repository(ui.ui(), self.wc_path) |
| 79 | 79 |
| 80 def pushrevisions(self): | 80 def pushrevisions(self): |
| 81 push_cmd.push_revisions_to_subversion( | 81 push_cmd.push_revisions_to_subversion( |
| 82 ui.ui(), repo=self.repo, hg_repo_path=self.wc_path, | 82 ui.ui(), repo=self.repo, hg_repo_path=self.wc_path, |
| 83 svn_url=fileurl(self.repo_path)) | 83 svn_url=fileurl(self.repo_path)) |
| 84 | |
| 85 def svnls(self, path, rev='HEAD'): | |
| 86 path = self.repo_path + '/' + path | |
| 87 path = fileurl(path) | |
| 88 args = ['svn', 'ls', '-r', rev, '-R', path] | |
| 89 p = subprocess.Popen(args, | |
| 90 stdout=subprocess.PIPE, | |
| 91 stderr=subprocess.PIPE) | |
| 92 stdout, stderr = p.communicate() | |
| 93 if p.returncode: | |
| 94 raise Exception('svn ls failed on %s: %r' % (path, stderr)) | |
| 95 entries = [e.strip('/') for e in stdout.splitlines()] | |
| 96 entries.sort() | |
| 97 return entries |
