comparison tests/test_pull.py @ 1417:4f1461428334 stable

test_hooks: cope with localrepo.parents() going away
author Augie Fackler <raf@durin42.com>
date Mon, 23 May 2016 17:15:58 -0400
parents 74e82a7da393
children cff81f35b31e
comparison
equal deleted inserted replaced
1409:fc80c25bc94b 1417:4f1461428334
18 repo, repo_path = self.load_and_fetch(fixture_name, *args, **kwargs) 18 repo, repo_path = self.load_and_fetch(fixture_name, *args, **kwargs)
19 return repo, repo_path 19 return repo, repo_path
20 20
21 def test_nochanges(self): 21 def test_nochanges(self):
22 self._loadupdate('single_rev.svndump') 22 self._loadupdate('single_rev.svndump')
23 state = self.repo.parents() 23 state = self.repo[None].parents()
24 commands.pull(self.repo.ui, self.repo) 24 commands.pull(self.repo.ui, self.repo)
25 self.assertEqual(state, self.repo.parents()) 25 self.assertEqual(state, self.repo[None].parents())
26 26
27 def test_onerevision_noupdate(self): 27 def test_onerevision_noupdate(self):
28 repo, repo_path = self._loadupdate('single_rev.svndump') 28 repo, repo_path = self._loadupdate('single_rev.svndump')
29 state = repo.parents() 29 state = repo[None].parents()
30 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'}) 30 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
31 commands.pull(self.repo.ui, repo) 31 commands.pull(self.repo.ui, repo)
32 self.assertEqual(state, repo.parents()) 32 self.assertEqual(state, repo[None].parents())
33 self.assertTrue('tip' not in repo['.'].tags()) 33 self.assertTrue('tip' not in repo['.'].tags())
34 34
35 def test_onerevision_doupdate(self): 35 def test_onerevision_doupdate(self):
36 repo, repo_path = self._loadupdate('single_rev.svndump') 36 repo, repo_path = self._loadupdate('single_rev.svndump')
37 state = repo.parents() 37 state = repo[None].parents()
38 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'}) 38 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
39 commands.pull(self.repo.ui, repo, update=True) 39 commands.pull(self.repo.ui, repo, update=True)
40 self.failIfEqual(state, repo.parents()) 40 self.failIfEqual(state, repo[None].parents())
41 self.assertTrue('tip' in repo['.'].tags()) 41 self.assertTrue('tip' in repo['.'].tags())
42 42
43 def test_onerevision_divergent(self): 43 def test_onerevision_divergent(self):
44 repo, repo_path = self._loadupdate('single_rev.svndump') 44 repo, repo_path = self._loadupdate('single_rev.svndump')
45 self.commitchanges((('alpha', 'alpha', 'Changed another way'),)) 45 self.commitchanges((('alpha', 'alpha', 'Changed another way'),))
46 state = repo.parents() 46 state = repo[None].parents()
47 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed one way'}) 47 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed one way'})
48 try: 48 try:
49 commands.pull(self.repo.ui, repo, update=True) 49 commands.pull(self.repo.ui, repo, update=True)
50 except hgutil.Abort: 50 except hgutil.Abort:
51 # hg < 1.9 raised when crossing branches 51 # hg < 1.9 raised when crossing branches
52 pass 52 pass
53 self.assertEqual(state, repo.parents()) 53 self.assertEqual(state, repo[None].parents())
54 self.assertTrue('tip' not in repo['.'].tags()) 54 self.assertTrue('tip' not in repo['.'].tags())
55 self.assertEqual(len(repo.heads()), 2) 55 self.assertEqual(len(repo.heads()), 2)
56 56
57 def test_tag_repull_doesnt_happen(self): 57 def test_tag_repull_doesnt_happen(self):
58 repo = self._loadupdate('branchtagcollision.svndump')[0] 58 repo = self._loadupdate('branchtagcollision.svndump')[0]