comparison tests/test_pull.py @ 868:cc1c870f1758

test_util: pass repo_path to _add_svn_rev() explicitely
author Patrick Mezard <patrick@mezard.eu>
date Thu, 19 Apr 2012 18:29:29 +0200
parents 04729f3a3d17
children c4ee11a5d04c
comparison
equal deleted inserted replaced
867:50c13e01c7e3 868:cc1c870f1758
10 class TestPull(test_util.TestBase): 10 class TestPull(test_util.TestBase):
11 def setUp(self): 11 def setUp(self):
12 super(TestPull, self).setUp() 12 super(TestPull, self).setUp()
13 13
14 def _loadupdate(self, fixture_name): 14 def _loadupdate(self, fixture_name):
15 return self._load_fixture_and_fetch(fixture_name, stupid=False, 15 repo, repo_path = self.load_and_fetch(fixture_name, stupid=False,
16 noupdate=False) 16 noupdate=False)
17 return repo, repo_path
17 18
18 def test_nochanges(self): 19 def test_nochanges(self):
19 self._loadupdate('single_rev.svndump') 20 self._loadupdate('single_rev.svndump')
20 state = self.repo.parents() 21 state = self.repo.parents()
21 commands.pull(self.repo.ui, self.repo) 22 commands.pull(self.repo.ui, self.repo)
22 self.assertEqual(state, self.repo.parents()) 23 self.assertEqual(state, self.repo.parents())
23 24
24 def test_onerevision_noupdate(self): 25 def test_onerevision_noupdate(self):
25 repo = self._loadupdate('single_rev.svndump') 26 repo, repo_path = self._loadupdate('single_rev.svndump')
26 state = repo.parents() 27 state = repo.parents()
27 self._add_svn_rev({'trunk/alpha': 'Changed'}) 28 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
28 commands.pull(self.repo.ui, repo) 29 commands.pull(self.repo.ui, repo)
29 self.assertEqual(state, repo.parents()) 30 self.assertEqual(state, repo.parents())
30 self.assertTrue('tip' not in repo[None].tags()) 31 self.assertTrue('tip' not in repo[None].tags())
31 32
32 def test_onerevision_doupdate(self): 33 def test_onerevision_doupdate(self):
33 repo = self._loadupdate('single_rev.svndump') 34 repo, repo_path = self._loadupdate('single_rev.svndump')
34 state = repo.parents() 35 state = repo.parents()
35 self._add_svn_rev({'trunk/alpha': 'Changed'}) 36 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
36 commands.pull(self.repo.ui, repo, update=True) 37 commands.pull(self.repo.ui, repo, update=True)
37 self.failIfEqual(state, repo.parents()) 38 self.failIfEqual(state, repo.parents())
38 self.assertTrue('tip' in repo[None].tags()) 39 self.assertTrue('tip' in repo[None].tags())
39 40
40 def test_onerevision_divergent(self): 41 def test_onerevision_divergent(self):
41 repo = self._loadupdate('single_rev.svndump') 42 repo, repo_path = self._loadupdate('single_rev.svndump')
42 self.commitchanges((('alpha', 'alpha', 'Changed another way'),)) 43 self.commitchanges((('alpha', 'alpha', 'Changed another way'),))
43 state = repo.parents() 44 state = repo.parents()
44 self._add_svn_rev({'trunk/alpha': 'Changed one way'}) 45 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed one way'})
45 try: 46 try:
46 commands.pull(self.repo.ui, repo, update=True) 47 commands.pull(self.repo.ui, repo, update=True)
47 except hgutil.Abort: 48 except hgutil.Abort:
48 # hg < 1.9 raised when crossing branches 49 # hg < 1.9 raised when crossing branches
49 pass 50 pass
50 self.assertEqual(state, repo.parents()) 51 self.assertEqual(state, repo.parents())
51 self.assertTrue('tip' not in repo[None].tags()) 52 self.assertTrue('tip' not in repo[None].tags())
52 self.assertEqual(len(repo.heads()), 2) 53 self.assertEqual(len(repo.heads()), 2)
53 54
54 def test_tag_repull_doesnt_happen(self): 55 def test_tag_repull_doesnt_happen(self):
55 repo = self._loadupdate('branchtagcollision.svndump') 56 repo = self._loadupdate('branchtagcollision.svndump')[0]
56 oldheads = map(node.hex, repo.heads()) 57 oldheads = map(node.hex, repo.heads())
57 commands.pull(repo.ui, repo) 58 commands.pull(repo.ui, repo)
58 self.assertEqual(oldheads, map(node.hex, repo.heads())) 59 self.assertEqual(oldheads, map(node.hex, repo.heads()))
59 60
60 def suite(): 61 def suite():