Mercurial > hgsubversion
comparison tests/test_fetch_branches.py @ 372:a62965b179c1
Test for open branches in the pull result.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Fri, 29 May 2009 13:41:28 +0200 |
parents | 4dfab1b8b7be |
children | af9fc01299b4 |
comparison
equal
deleted
inserted
replaced
371:b45671850969 | 372:a62965b179c1 |
---|---|
18 def _load_fixture_and_fetch_with_anchor(self, fixture_name, anchor): | 18 def _load_fixture_and_fetch_with_anchor(self, fixture_name, anchor): |
19 test_util.load_svndump_fixture(self.repo_path, fixture_name) | 19 test_util.load_svndump_fixture(self.repo_path, fixture_name) |
20 source = '%s#%s' % (test_util.fileurl(self.repo_path), anchor) | 20 source = '%s#%s' % (test_util.fileurl(self.repo_path), anchor) |
21 repo = hg.clone(ui.ui(), source=source, dest=self.wc_path) | 21 repo = hg.clone(ui.ui(), source=source, dest=self.wc_path) |
22 return hg.repository(ui.ui(), self.wc_path) | 22 return hg.repository(ui.ui(), self.wc_path) |
23 | |
24 def openbranches(self, repo): | |
25 hctxs = [repo[hn] for hn in repo.heads(closed=False)] | |
26 branches = set(ctx.branch() for ctx in hctxs) | |
27 branches.discard('closed-branches') | |
28 return sorted(branches) | |
23 | 29 |
24 def test_unrelatedbranch(self, stupid=False): | 30 def test_unrelatedbranch(self, stupid=False): |
25 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) | 31 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) |
26 heads = [repo[n] for n in repo.heads()] | 32 heads = [repo[n] for n in repo.heads()] |
27 heads = dict([(ctx.branch(), ctx) for ctx in heads]) | 33 heads = dict([(ctx.branch(), ctx) for ctx in heads]) |
46 stupid) | 52 stupid) |
47 self.assertEqual(node.hex(repo['default'].node()), | 53 self.assertEqual(node.hex(repo['default'].node()), |
48 '14d252aef315857df241dd3fa4bc7833b09bd2f5') | 54 '14d252aef315857df241dd3fa4bc7833b09bd2f5') |
49 self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch') | 55 self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch') |
50 self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default') | 56 self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default') |
57 expected = ['default', 'old_trunk'] | |
58 self.assertEqual(self.openbranches(repo), expected) | |
51 | 59 |
52 def test_renamed_branch_to_trunk_stupid(self): | 60 def test_renamed_branch_to_trunk_stupid(self): |
53 self.test_renamed_branch_to_trunk(stupid=True) | 61 self.test_renamed_branch_to_trunk(stupid=True) |
54 | 62 |
55 def test_replace_trunk_with_branch(self, stupid=False): | 63 def test_replace_trunk_with_branch(self, stupid=False): |
58 self.assertEqual(repo['default'].parents()[0].branch(), 'test') | 66 self.assertEqual(repo['default'].parents()[0].branch(), 'test') |
59 self.assertEqual(node.hex(repo['closed-branches'].parents()[0].node()), | 67 self.assertEqual(node.hex(repo['closed-branches'].parents()[0].node()), |
60 '2cd09772e0f6ddf2d13c60ef3c1be11ad5a7dfae') | 68 '2cd09772e0f6ddf2d13c60ef3c1be11ad5a7dfae') |
61 self.assertEqual(node.hex(repo['default'].node()), | 69 self.assertEqual(node.hex(repo['default'].node()), |
62 '8a525ca0671f456e6b1417187bf86c6115d2cb78') | 70 '8a525ca0671f456e6b1417187bf86c6115d2cb78') |
71 self.assertEqual(self.openbranches(repo), ['default']) | |
63 | 72 |
64 def test_replace_trunk_with_branch_stupid(self): | 73 def test_replace_trunk_with_branch_stupid(self): |
65 self.test_replace_trunk_with_branch(stupid=True) | 74 self.test_replace_trunk_with_branch(stupid=True) |
66 | 75 |
67 def test_branch_create_with_dir_delete_works(self, stupid=False): | 76 def test_branch_create_with_dir_delete_works(self, stupid=False): |