comparison tests/test_tags.py @ 331:75f082b5897e

Switch to using url scheme wrappers instead of duplicating each command we wrap. The 'hg svn url' command has been killed; the replacement is '.hg/hgrc'. More stuff related to its disappearance has been stripped, including two tests. HgChangeReceiver now takes a UUID argument, which it uses to ensure that remote repositories remain unchanged. This is a temporary solution, and I'm not entirely satisfied with how it's done either. Access to the UUID file has been isolated in a HgChangeReceiver property. Some more tests have been updated to use ui.pushbuffer()/popbuffer(), and to pass through the Mercurial API. Moved the arguments to wrappers.pull() to the UI configuration. Also, remove HgChangeReceiver.opts in favour of a 'usebranchnames' instance & configuration variable. The name is taken from the ConvertExtension.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 15 May 2009 19:18:43 +0200
parents 91c818377703
children 46e69be8e2c8
comparison
equal deleted inserted replaced
330:5f8f2fd4fd54 331:75f082b5897e
4 from mercurial import node 4 from mercurial import node
5 from mercurial import ui 5 from mercurial import ui
6 6
7 import test_util 7 import test_util
8 8
9 import tag_repo 9 import svnrepo
10 10
11 class TestTags(test_util.TestBase): 11 class TestTags(test_util.TestBase):
12 def _load_fixture_and_fetch(self, fixture_name, stupid=False): 12 def _load_fixture_and_fetch(self, fixture_name, stupid=False):
13 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,
14 self.wc_path, stupid=stupid) 14 self.wc_path, stupid=stupid)
15 15
16 def getrepo(self):
17 ui_ = ui.ui()
18 repo = hg.repository(ui_, self.wc_path)
19 repo.__class__ = tag_repo.generate_repo_class(ui_, repo)
20 return repo
21
22 def _test_tag_revision_info(self, repo): 16 def _test_tag_revision_info(self, repo):
17 print repo.tags()
23 self.assertEqual(node.hex(repo[0].node()), 18 self.assertEqual(node.hex(repo[0].node()),
24 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') 19 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
25 self.assertEqual(node.hex(repo['tip'].node()), 20 self.assertEqual(node.hex(repo['tip'].node()),
26 'c95251e0dd04697deee99b79cc407d7db76e6a5f') 21 'c95251e0dd04697deee99b79cc407d7db76e6a5f')
27 self.assertEqual(repo['tip'], repo[1]) 22 self.assertEqual(repo['tip'], repo[1])
28 23
29 def test_tags(self, stupid=False): 24 def test_tags(self, stupid=False):
30 repo = self._load_fixture_and_fetch('basic_tag_tests.svndump', 25 repo = self._load_fixture_and_fetch('basic_tag_tests.svndump',
31 stupid=stupid) 26 stupid=stupid)
32 self._test_tag_revision_info(repo) 27 self._test_tag_revision_info(repo)
33 repo = self.getrepo() 28 repo = self.repo
34 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node()) 29 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node())
35 self.assertEqual(repo['tip'].node(), repo['tag/copied_tag'].node()) 30 self.assertEqual(repo['tip'].node(), repo['tag/copied_tag'].node())
36 31
37 def test_tags_stupid(self): 32 def test_tags_stupid(self):
38 self.test_tags(stupid=True) 33 self.test_tags(stupid=True)
39 34
40 def test_remove_tag(self, stupid=False): 35 def test_remove_tag(self, stupid=False):
41 repo = self._load_fixture_and_fetch('remove_tag_test.svndump', 36 repo = self._load_fixture_and_fetch('remove_tag_test.svndump',
42 stupid=stupid) 37 stupid=stupid)
43 self._test_tag_revision_info(repo) 38 self._test_tag_revision_info(repo)
44 repo = self.getrepo() 39 repo = self.repo
45 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node()) 40 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node())
46 self.assert_('tag/copied_tag' not in repo.tags()) 41 self.assert_('tag/copied_tag' not in repo.tags())
47 42
48 def test_remove_tag_stupid(self): 43 def test_remove_tag_stupid(self):
49 self.test_remove_tag(stupid=True) 44 self.test_remove_tag(stupid=True)
50 45
51 def test_rename_tag(self, stupid=False): 46 def test_rename_tag(self, stupid=False):
52 repo = self._load_fixture_and_fetch('rename_tag_test.svndump', 47 repo = self._load_fixture_and_fetch('rename_tag_test.svndump',
53 stupid=stupid) 48 stupid=stupid)
54 self._test_tag_revision_info(repo) 49 self._test_tag_revision_info(repo)
55 repo = self.getrepo() 50 repo = self.repo
56 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node()) 51 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node())
57 self.assertEqual(repo['tip'].node(), repo['tag/other_tag_r3'].node()) 52 self.assertEqual(repo['tip'].node(), repo['tag/other_tag_r3'].node())
58 self.assert_('tag/copied_tag' not in repo.tags()) 53 self.assert_('tag/copied_tag' not in repo.tags())
59 54
60 def test_rename_tag_stupid(self): 55 def test_rename_tag_stupid(self):
61 self.test_rename_tag(stupid=True) 56 self.test_rename_tag(stupid=True)
62 57
63 def test_branch_from_tag(self, stupid=False): 58 def test_branch_from_tag(self, stupid=False):
64 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', 59 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
65 stupid=stupid) 60 stupid=stupid)
66 repo = self.getrepo() 61 repo = self.repo
67 self.assertEqual(repo['tip'].node(), repo['branch_from_tag'].node()) 62 self.assertEqual(repo['tip'].node(), repo['branch_from_tag'].node())
68 self.assertEqual(repo[1].node(), repo['tag/tag_r3'].node()) 63 self.assertEqual(repo[1].node(), repo['tag/tag_r3'].node())
69 self.assertEqual(repo['branch_from_tag'].parents()[0].node(), 64 self.assertEqual(repo['branch_from_tag'].parents()[0].node(),
70 repo['tag/copied_tag'].node()) 65 repo['tag/copied_tag'].node())
71 66
73 self.test_branch_from_tag(stupid=True) 68 self.test_branch_from_tag(stupid=True)
74 69
75 def test_tag_by_renaming_branch(self, stupid=False): 70 def test_tag_by_renaming_branch(self, stupid=False):
76 repo = self._load_fixture_and_fetch('tag_by_rename_branch.svndump', 71 repo = self._load_fixture_and_fetch('tag_by_rename_branch.svndump',
77 stupid=stupid) 72 stupid=stupid)
78 repo = self.getrepo() 73 repo = self.repo
79 self.assertEqual(repo['tip'], repo['closed-branches']) 74 self.assertEqual(repo['tip'], repo['closed-branches'])
80 self.assertEqual(node.hex(repo['tip'].node()), 75 self.assertEqual(node.hex(repo['tip'].node()),
81 '2f0a3abe2004c0fa01f5f6074a8b5441e9c80c2a') 76 '2f0a3abe2004c0fa01f5f6074a8b5441e9c80c2a')
82 taggedrev = repo['tip'].parents()[0] 77 taggedrev = repo['tip'].parents()[0]
83 self.assertEqual(node.hex(taggedrev.node()), 78 self.assertEqual(node.hex(taggedrev.node()),