Mercurial > hgsubversion
comparison tests/test_fetch_branches.py @ 815:e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
They are no longer the same across Mercurial version since 301725c3df9a.
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Wed, 15 Jun 2011 14:44:14 +0200 |
| parents | d2ef7220a079 |
| children | 86d124a8768e |
comparison
equal
deleted
inserted
replaced
| 814:d32735c507cd | 815:e62e84a9464b |
|---|---|
| 17 test_util.load_svndump_fixture(self.repo_path, fixture_name) | 17 test_util.load_svndump_fixture(self.repo_path, fixture_name) |
| 18 source = '%s#%s' % (test_util.fileurl(self.repo_path), anchor) | 18 source = '%s#%s' % (test_util.fileurl(self.repo_path), anchor) |
| 19 repo = hg.clone(self.ui(), source=source, dest=self.wc_path) | 19 repo = hg.clone(self.ui(), source=source, dest=self.wc_path) |
| 20 return hg.repository(self.ui(), self.wc_path) | 20 return hg.repository(self.ui(), self.wc_path) |
| 21 | 21 |
| 22 def branches(self, repo): | |
| 23 hctxs = [repo[hn] for hn in repo.heads()] | |
| 24 openbranches = set(ctx.branch() for ctx in hctxs if | |
| 25 ctx.extra().get('close', None) != '1') | |
| 26 closedbranches = set(ctx.branch() for ctx in hctxs if | |
| 27 ctx.extra().get('close', None) == '1') | |
| 28 return sorted(openbranches), sorted(closedbranches) | |
| 29 | |
| 22 def openbranches(self, repo): | 30 def openbranches(self, repo): |
| 23 hctxs = [repo[hn] for hn in repo.heads()] | 31 return self.branches(repo)[0] |
| 24 branches = set(ctx.branch() for ctx in hctxs if | |
| 25 ctx.extra().get('close', None) != '1') | |
| 26 return sorted(branches) | |
| 27 | 32 |
| 28 def test_rename_branch_parent(self, stupid=False): | 33 def test_rename_branch_parent(self, stupid=False): |
| 29 repo = self._load_fixture_and_fetch('rename_branch_parent_dir.svndump', stupid) | 34 repo = self._load_fixture_and_fetch('rename_branch_parent_dir.svndump', stupid) |
| 30 heads = [repo[n] for n in repo.heads()] | 35 heads = [repo[n] for n in repo.heads()] |
| 31 heads = dict([(ctx.branch(), ctx) for ctx in heads]) | 36 heads = dict([(ctx.branch(), ctx) for ctx in heads]) |
| 56 self.test_unorderedbranch(True) | 61 self.test_unorderedbranch(True) |
| 57 | 62 |
| 58 def test_renamed_branch_to_trunk(self, stupid=False): | 63 def test_renamed_branch_to_trunk(self, stupid=False): |
| 59 repo = self._load_fixture_and_fetch('branch_rename_to_trunk.svndump', | 64 repo = self._load_fixture_and_fetch('branch_rename_to_trunk.svndump', |
| 60 stupid) | 65 stupid) |
| 61 self.assertEqual(node.hex(repo['default'].node()), | |
| 62 '14d252aef315857df241dd3fa4bc7833b09bd2f5') | |
| 63 self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch') | 66 self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch') |
| 67 self.assert_('iota' in repo['default']) | |
| 64 self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default') | 68 self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default') |
| 69 self.assert_('iota' not in repo['old_trunk']) | |
| 65 expected = ['default', 'old_trunk'] | 70 expected = ['default', 'old_trunk'] |
| 66 self.assertEqual(self.openbranches(repo), expected) | 71 self.assertEqual(self.openbranches(repo), expected) |
| 67 | 72 |
| 68 def test_renamed_branch_to_trunk_stupid(self): | 73 def test_renamed_branch_to_trunk_stupid(self): |
| 69 self.test_renamed_branch_to_trunk(stupid=True) | 74 self.test_renamed_branch_to_trunk(stupid=True) |
| 125 self.test_branches_weird_moves(True) | 130 self.test_branches_weird_moves(True) |
| 126 | 131 |
| 127 def test_branch_delete_parent_dir(self, stupid=False): | 132 def test_branch_delete_parent_dir(self, stupid=False): |
| 128 repo = self._load_fixture_and_fetch('branch_delete_parent_dir.svndump', | 133 repo = self._load_fixture_and_fetch('branch_delete_parent_dir.svndump', |
| 129 stupid) | 134 stupid) |
| 130 self.assertEqual(node.hex(repo['tip'].node()), | 135 openb, closedb = self.branches(repo) |
| 131 '4108a81a82c7925d5551091165dc54c41b06a8a8') | 136 self.assertEqual(openb, []) |
| 137 self.assertEqual(closedb, ['dev_branch']) | |
| 138 self.assertEqual(list(repo['dev_branch']), ['foo']) | |
| 132 | 139 |
| 133 def test_replace_branch_with_branch(self, stupid=False): | 140 def test_replace_branch_with_branch(self, stupid=False): |
| 134 repo = self._load_fixture_and_fetch('replace_branch_with_branch.svndump', | 141 repo = self._load_fixture_and_fetch('replace_branch_with_branch.svndump', |
| 135 stupid) | 142 stupid) |
| 136 self.assertEqual(7, len(repo)) | 143 self.assertEqual(7, len(repo)) |
