Mercurial > hgsubversion
comparison tests/test_pull.py @ 689:35a1e93b6f78
tests: move _add_svn_rev to test_util for reuse
author | Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
---|---|
date | Wed, 08 Sep 2010 09:57:06 +0200 |
parents | 76c833526fbc |
children | b64173a27ce8 |
comparison
equal
deleted
inserted
replaced
688:073132fc27f1 | 689:35a1e93b6f78 |
---|---|
7 from mercurial import commands | 7 from mercurial import commands |
8 | 8 |
9 class TestPull(test_util.TestBase): | 9 class TestPull(test_util.TestBase): |
10 def setUp(self): | 10 def setUp(self): |
11 super(TestPull, self).setUp() | 11 super(TestPull, self).setUp() |
12 self.svn_wc = None | |
13 | 12 |
14 def _load_fixture_and_fetch(self, fixture_name): | 13 def _load_fixture_and_fetch(self, fixture_name): |
15 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, | 14 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, |
16 self.wc_path, stupid=False, | 15 self.wc_path, stupid=False, |
17 noupdate=False) | 16 noupdate=False) |
18 | |
19 def _add_svn_rev(self, changes): | |
20 # changes is a dict of filename -> contents | |
21 if self.svn_wc is None: | |
22 self.svn_wc = os.path.join(self.tmpdir, 'testsvn_wc') | |
23 subprocess.call([ | |
24 'svn', 'co', '-q', test_util.fileurl(self.repo_path), | |
25 self.svn_wc | |
26 ], | |
27 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
28 | |
29 for filename, contents in changes.iteritems(): | |
30 # filenames are / separated | |
31 filename = filename.replace('/', os.path.sep) | |
32 filename = os.path.join(self.svn_wc, filename) | |
33 open(filename, 'w').write(contents) | |
34 # may be redundant | |
35 subprocess.call(['svn', 'add', '-q', filename], | |
36 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
37 subprocess.call([ | |
38 'svn', 'commit', '-q', self.svn_wc, '-m', 'test changes'], | |
39 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
40 | 17 |
41 def test_nochanges(self): | 18 def test_nochanges(self): |
42 self._load_fixture_and_fetch('single_rev.svndump') | 19 self._load_fixture_and_fetch('single_rev.svndump') |
43 state = self.repo.parents() | 20 state = self.repo.parents() |
44 commands.pull(self.repo.ui, self.repo) | 21 commands.pull(self.repo.ui, self.repo) |