Mercurial > hgsubversion
comparison tests/test_fetch_branches.py @ 284:f8f9a2993705
Implement parseurl support (#revision in repository urls)
Note: Normally when using parseurl, hg clone will treat the revision after # as
if it was passed in as --rev, treats that rev as a head and won't clone beyond
that. This wasn't implemented here, hence all the TODO's in the comments.
All we do is use the checkout parameter where appropriate to update the wc to
the selected revision.
author | Martijn Pieters <mj@zopatista.com> |
---|---|
date | Mon, 27 Apr 2009 09:39:39 -0500 |
parents | 60acc38eac96 |
children | 942f198b8ff5 |
comparison
equal
deleted
inserted
replaced
283:521d9c1bb11d | 284:f8f9a2993705 |
---|---|
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, noupdate=True): | 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, |
12 noupdate=noupdate) | 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) | |
13 | 22 |
14 def test_unrelatedbranch(self, stupid=False): | 23 def test_unrelatedbranch(self, stupid=False): |
15 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) | 24 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid) |
16 heads = [repo[n] for n in repo.heads()] | 25 heads = [repo[n] for n in repo.heads()] |
17 heads = dict([(ctx.branch(), ctx) for ctx in heads]) | 26 heads = dict([(ctx.branch(), ctx) for ctx in heads]) |
66 self.assertEqual(repo[None].branch(), 'default') | 75 self.assertEqual(repo[None].branch(), 'default') |
67 self.assertTrue('tip' not in repo[None].tags()) | 76 self.assertTrue('tip' not in repo[None].tags()) |
68 | 77 |
69 def test_branch_tip_update_to_default_stupid(self): | 78 def test_branch_tip_update_to_default_stupid(self): |
70 self.test_branch_tip_update_to_default(True) | 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]]) | |
71 | 86 |
72 def suite(): | 87 def suite(): |
73 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches), | 88 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches), |
74 ] | 89 ] |
75 return unittest.TestSuite(all) | 90 return unittest.TestSuite(all) |