Mercurial > hgsubversion
comparison tests/test_fetch_branches.py @ 304:ce676eff002b
First merge, totally untested.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 01 May 2009 10:28:59 +0200 |
parents | f8f9a2993705 |
children | 942f198b8ff5 |
comparison
equal
deleted
inserted
replaced
303:f423a8780832 | 304:ce676eff002b |
---|---|
1 import unittest | 1 import unittest |
2 | 2 |
3 from mercurial import hg | |
3 from mercurial import node | 4 from mercurial import node |
5 from mercurial import ui | |
4 | 6 |
5 import test_util | 7 import test_util |
8 import wrappers | |
6 | 9 |
7 | 10 |
8 class TestFetchBranches(test_util.TestBase): | 11 class TestFetchBranches(test_util.TestBase): |
9 def _load_fixture_and_fetch(self, fixture_name, stupid): | 12 def _load_fixture_and_fetch(self, fixture_name, stupid, noupdate=True): |
10 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, | 13 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, |
11 self.wc_path, stupid=stupid) | 14 self.wc_path, stupid=stupid, |
15 noupdate=noupdate) | |
16 | |
17 def _load_fixture_and_fetch_with_anchor(self, fixture_name, anchor): | |
18 test_util.load_svndump_fixture(self.repo_path, fixture_name) | |
19 source = '%s#%s' % (test_util.fileurl(self.repo_path), anchor) | |
20 wrappers.clone(None, ui.ui(), source=source, dest=self.wc_path) | |
21 return hg.repository(ui.ui(), self.wc_path) | |
12 | 22 |
13 def test_unrelatedbranch(self, stupid=False): | 23 def test_unrelatedbranch(self, stupid=False): |
14 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) | 24 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) |
15 heads = [repo[n] for n in repo.heads()] | 25 heads = [repo[n] for n in repo.heads()] |
16 heads = dict([(ctx.branch(), ctx) for ctx in heads]) | 26 heads = dict([(ctx.branch(), ctx) for ctx in heads]) |
51 '8a525ca0671f456e6b1417187bf86c6115d2cb78') | 61 '8a525ca0671f456e6b1417187bf86c6115d2cb78') |
52 | 62 |
53 def test_replace_trunk_with_branch_stupid(self): | 63 def test_replace_trunk_with_branch_stupid(self): |
54 self.test_replace_trunk_with_branch(stupid=True) | 64 self.test_replace_trunk_with_branch(stupid=True) |
55 | 65 |
66 def test_branch_create_with_dir_delete_works(self, stupid=False): | |
67 repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump', | |
68 stupid) | |
69 self.assertEqual(repo['tip'].manifest().keys(), | |
70 ['alpha', 'beta', 'iota', 'gamma', ]) | |
71 | |
72 def test_branch_tip_update_to_default(self, stupid=False): | |
73 repo = self._load_fixture_and_fetch('unorderedbranch.svndump', | |
74 stupid, noupdate=False) | |
75 self.assertEqual(repo[None].branch(), 'default') | |
76 self.assertTrue('tip' not in repo[None].tags()) | |
77 | |
78 def test_branch_tip_update_to_default_stupid(self): | |
79 self.test_branch_tip_update_to_default(True) | |
80 | |
81 def test_branch_tip_update_to_branch_anchor(self): | |
82 repo = self._load_fixture_and_fetch_with_anchor( | |
83 'unorderedbranch.svndump', 'branch') | |
84 self.assertEqual(repo[None].branch(), 'branch') | |
85 self.assertEqual(repo[None].parents()[0], repo[repo.branchheads()[0]]) | |
86 | |
56 def suite(): | 87 def suite(): |
57 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches), | 88 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches), |
58 ] | 89 ] |
59 return unittest.TestSuite(all) | 90 return unittest.TestSuite(all) |