Mercurial > hgsubversion
comparison tests/test_fetch_command.py @ 18:f4c751037a4a
Add a quick test for diff-based pull.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 08 Oct 2008 08:14:31 -0500 |
parents | 48a44546c12f |
children | 8626f3d2e50b |
comparison
equal
deleted
inserted
replaced
17:31aa63ac778c | 18:f4c751037a4a |
---|---|
7 from mercurial import ui | 7 from mercurial import ui |
8 from mercurial import node | 8 from mercurial import node |
9 | 9 |
10 import fetch_command | 10 import fetch_command |
11 import test_util | 11 import test_util |
12 | |
12 | 13 |
13 class TestBasicRepoLayout(unittest.TestCase): | 14 class TestBasicRepoLayout(unittest.TestCase): |
14 def setUp(self): | 15 def setUp(self): |
15 self.oldwd = os.getcwd() | 16 self.oldwd = os.getcwd() |
16 self.tmpdir = tempfile.mkdtemp('svnwrap_test') | 17 self.tmpdir = tempfile.mkdtemp('svnwrap_test') |
76 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') | 77 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') |
77 self.assertEqual(len(repo['tip'].parents()), 1) | 78 self.assertEqual(len(repo['tip'].parents()), 1) |
78 self.assertEqual(repo['tip'], repo['default']) | 79 self.assertEqual(repo['tip'], repo['default']) |
79 self.assertEqual(len(repo.heads()), 2) | 80 self.assertEqual(len(repo.heads()), 2) |
80 | 81 |
82 | |
83 class TestStupidPull(unittest.TestCase): | |
84 def setUp(self): | |
85 self.oldwd = os.getcwd() | |
86 self.tmpdir = tempfile.mkdtemp('svnwrap_test') | |
87 self.repo_path = '%s/testrepo' % self.tmpdir | |
88 self.wc_path = '%s/testrepo_wc' % self.tmpdir | |
89 | |
90 def tearDown(self): | |
91 shutil.rmtree(self.tmpdir) | |
92 os.chdir(self.oldwd) | |
93 | |
94 def test_stupid(self): | |
95 test_util.load_svndump_fixture(self.repo_path, 'two_heads.svndump') | |
96 fetch_command.fetch_revisions(ui.ui(), | |
97 svn_url='file://%s' % self.repo_path, | |
98 hg_repo_path=self.wc_path, | |
99 stupid=True) | |
100 repo = hg.repository(ui.ui(), self.wc_path) | |
101 # TODO there must be a better way than repo[0] for this check | |
102 self.assertEqual(node.hex(repo[0].node()), | |
103 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') | |
104 self.assertEqual(node.hex(repo['tip'].node()), | |
105 'a595c77cfcaa3d1ba9e04b2c55c68bc6bf2b0fbf') | |
106 self.assertEqual(node.hex(repo['the_branch'].node()), | |
107 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') | |
108 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()), | |
109 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') | |
110 self.assertEqual(len(repo['tip'].parents()), 1) | |
111 self.assertEqual(repo['tip'], repo['default']) | |
112 self.assertEqual(len(repo.heads()), 2) | |
113 | |
81 def suite(): | 114 def suite(): |
82 return unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout) | 115 all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout), |
116 unittest.TestLoader().loadTestsFromTestCase(TestStupidPull), | |
117 ] | |
118 return unittest.TestSuite(all) |