Mercurial > hgsubversion
comparison tests/test_push_renames.py @ 78:072010a271c6
Fix basic issues with tests on Windows
- shutil.rmtree() fails if there are any read-only files (svn store)
- Fix files:// URLs
- os.spawnvp()/Popen4() do not exist under Windows, use subprocess
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Sun, 09 Nov 2008 18:08:35 -0600 |
| parents | 49b7cbe4c8e3 |
| children | 71de43e9f614 |
comparison
equal
deleted
inserted
replaced
| 77:ed3dd5bf45da | 78:072010a271c6 |
|---|---|
| 1 import os | 1 import os |
| 2 import shutil | |
| 3 import sys | 2 import sys |
| 4 import tempfile | 3 import tempfile |
| 5 import unittest | 4 import unittest |
| 6 | 5 |
| 7 from mercurial import context | 6 from mercurial import context |
| 19 def setUp(self): | 18 def setUp(self): |
| 20 self.oldwd = os.getcwd() | 19 self.oldwd = os.getcwd() |
| 21 self.tmpdir = tempfile.mkdtemp('svnwrap_test') | 20 self.tmpdir = tempfile.mkdtemp('svnwrap_test') |
| 22 self.repo_path = '%s/testrepo' % self.tmpdir | 21 self.repo_path = '%s/testrepo' % self.tmpdir |
| 23 self.wc_path = '%s/testrepo_wc' % self.tmpdir | 22 self.wc_path = '%s/testrepo_wc' % self.tmpdir |
| 24 test_util.load_svndump_fixture(self.repo_path, 'pushrenames.svndump') | 23 test_util.load_fixture_and_fetch('pushrenames.svndump', |
| 25 fetch_command.fetch_revisions(ui.ui(), | 24 self.repo_path, |
| 26 svn_url='file://%s' % self.repo_path, | 25 self.wc_path, |
| 27 hg_repo_path=self.wc_path) | 26 True) |
| 28 | 27 |
| 29 # define this as a property so that it reloads anytime we need it | 28 # define this as a property so that it reloads anytime we need it |
| 30 @property | 29 @property |
| 31 def repo(self): | 30 def repo(self): |
| 32 return hg.repository(ui.ui(), self.wc_path) | 31 return hg.repository(ui.ui(), self.wc_path) |
| 33 | 32 |
| 34 def tearDown(self): | 33 def tearDown(self): |
| 35 shutil.rmtree(self.tmpdir) | 34 test_util.rmtree(self.tmpdir) |
| 36 os.chdir(self.oldwd) | 35 os.chdir(self.oldwd) |
| 37 | 36 |
| 38 def _commitchanges(self, repo, changes): | 37 def _commitchanges(self, repo, changes): |
| 39 parentctx = repo['tip'] | 38 parentctx = repo['tip'] |
| 40 | 39 |
| 116 ('e', None, None), | 115 ('e', None, None), |
| 117 ] | 116 ] |
| 118 self._commitchanges(repo, changes) | 117 self._commitchanges(repo, changes) |
| 119 | 118 |
| 120 hg.update(repo, repo['tip'].node()) | 119 hg.update(repo, repo['tip'].node()) |
| 121 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo, | 120 push_cmd.push_revisions_to_subversion( |
| 122 hg_repo_path=self.wc_path, | 121 ui.ui(), repo=self.repo, hg_repo_path=self.wc_path, |
| 123 svn_url='file://'+self.repo_path) | 122 svn_url=test_util.fileurl(self.repo_path)) |
| 124 tip = self.repo['tip'] | 123 tip = self.repo['tip'] |
| 125 # self._debug_print_copies(tip) | 124 # self._debug_print_copies(tip) |
| 126 self.assertchanges(changes, tip) | 125 self.assertchanges(changes, tip) |
| 127 | 126 |
| 128 def suite(): | 127 def suite(): |
