comparison tests/test_fetch_command.py @ 15:db32dee803a8

Add some basic tests of branching.
author Augie Fackler <durin42@gmail.com>
date Tue, 07 Oct 2008 20:43:44 -0500
parents d78dbf88c13d
children 48a44546c12f
comparison
equal deleted inserted replaced
14:d78dbf88c13d 15:db32dee803a8
41 self.assertEqual(node.hex(repo[0].node()), 41 self.assertEqual(node.hex(repo[0].node()),
42 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 42 'a47d0ce778660a91c31bf2c21c448e9ee296ac90')
43 self.assertEqual(node.hex(repo['tip'].node()), 43 self.assertEqual(node.hex(repo['tip'].node()),
44 'bf3767835b3b32ecc775a298c2fa27134dd91c11') 44 'bf3767835b3b32ecc775a298c2fa27134dd91c11')
45 self.assertEqual(repo['tip'], repo[1]) 45 self.assertEqual(repo['tip'], repo[1])
46
47 def test_branches(self):
48 util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump')
49 fetch_command.fetch_revisions(ui.ui(),
50 svn_url='file://%s' % self.repo_path,
51 hg_repo_path=self.wc_path)
52 repo = hg.repository(ui.ui(), self.wc_path)
53 # TODO there must be a better way than repo[0] for this check
54 self.assertEqual(node.hex(repo[0].node()),
55 'a47d0ce778660a91c31bf2c21c448e9ee296ac90')
56 self.assertEqual(node.hex(repo['tip'].node()),
57 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e')
58 self.assertEqual(len(repo['tip'].parents()), 1)
59 self.assertEqual(repo['tip'].parents()[0], repo['default'])
60 self.assertEqual(len(repo.heads()), 1)
61
62 def test_two_branches_with_heads(self):
63 util.load_svndump_fixture(self.repo_path, 'two_heads.svndump')
64 fetch_command.fetch_revisions(ui.ui(),
65 svn_url='file://%s' % self.repo_path,
66 hg_repo_path=self.wc_path)
67 repo = hg.repository(ui.ui(), self.wc_path)
68 # TODO there must be a better way than repo[0] for this check
69 self.assertEqual(node.hex(repo[0].node()),
70 'a47d0ce778660a91c31bf2c21c448e9ee296ac90')
71 self.assertEqual(node.hex(repo['tip'].node()),
72 'a595c77cfcaa3d1ba9e04b2c55c68bc6bf2b0fbf')
73 self.assertEqual(node.hex(repo['the_branch'].node()),
74 '8ccaba5f0eae124487e413abd904a013f7f6fdeb')
75 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
76 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e')
77 self.assertEqual(len(repo['tip'].parents()), 1)
78 self.assertEqual(repo['tip'], repo['default'])
79 self.assertEqual(len(repo.heads()), 2)