comparison tests/test_utility_commands.py @ 140:9ffde8662967

util: Add a command to normalize svn urls and use it in a couple of places. Test that it works and prevents failed assertions.
author Augie Fackler <durin42@gmail.com>
date Thu, 11 Dec 2008 20:41:57 -0600
parents 89a737852d33
children 04800fda7af5
comparison
equal deleted inserted replaced
139:89a737852d33 140:9ffde8662967
2 2
3 from mercurial import ui 3 from mercurial import ui
4 from mercurial import hg 4 from mercurial import hg
5 5
6 import utility_commands 6 import utility_commands
7 7 import fetch_command
8 import test_util 8 import test_util
9 9
10 expected_info_output = '''URL: file://%(repo)s/%(branch)s 10 expected_info_output = '''URL: file://%(repo)s/%(branch)s
11 Repository Root: None 11 Repository Root: None
12 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf 12 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf
46 hg.update(self.repo, 'tip') 46 hg.update(self.repo, 'tip')
47 u = ui.ui() 47 u = ui.ui()
48 utility_commands.print_wc_url(u, self.repo, self.wc_path) 48 utility_commands.print_wc_url(u, self.repo, self.wc_path)
49 expected = 'file://%s\n' % urllib.quote(self.repo_path) 49 expected = 'file://%s\n' % urllib.quote(self.repo_path)
50 self.assertEqual(u.stream.getvalue(), expected) 50 self.assertEqual(u.stream.getvalue(), expected)
51
52 def test_url_is_normalized(self):
53 """Verify url gets normalized on initial clone.
54 """
55 test_util.load_svndump_fixture(self.repo_path, 'two_revs.svndump')
56 fetch_command.fetch_revisions(ui.ui(),
57 svn_url=test_util.fileurl(self.repo_path)+'/',
58 hg_repo_path=self.wc_path,
59 stupid=False)
60 hg.update(self.repo, 'tip')
61 u = ui.ui()
62 utility_commands.print_wc_url(u, self.repo, self.wc_path)
63 expected = 'file://%s\n' % urllib.quote(self.repo_path)
64 self.assertEqual(u.stream.getvalue(), expected)