annotate tests/test_utility_commands.py @ 217:6eb691a163cd

hg_delta_editor: stop using foobaz as a bogus filename.
author Augie Fackler <durin42@gmail.com>
date Sat, 28 Mar 2009 14:27:27 -0500
parents 91db8fc049b0
children 4c3bad24f950
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
149
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
1 import os
153
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
2 import unittest
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 from mercurial import ui
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 from mercurial import hg
149
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
6 from mercurial import revlog
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
7 from mercurial import context
157
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
8 from mercurial import node
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 import utility_commands
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
11 import fetch_command
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 import test_util
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13
178
33ebdcb75bcd test_utility_commands: fix normalized URL references under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 160
diff changeset
14 expected_info_output = '''URL: %(repourl)s/%(branch)s
33ebdcb75bcd test_utility_commands: fix normalized URL references under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 160
diff changeset
15 Repository Root: %(repourl)s
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 Revision: %(rev)s
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 Node Kind: directory
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 Last Changed Author: durin
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 Last Changed Rev: %(rev)s
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 Last Changed Date: %(date)s
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 '''
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 class UtilityTests(test_util.TestBase):
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 def test_info_output(self):
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 self._load_fixture_and_fetch('two_heads.svndump')
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 hg.update(self.repo, 'the_branch')
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 u = ui.ui()
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 utility_commands.run_svn_info(u, self.repo, self.wc_path)
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 expected = (expected_info_output %
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 {'date': '2008-10-08 01:39:05 +0000 (Wed, 08 Oct 2008)',
178
33ebdcb75bcd test_utility_commands: fix normalized URL references under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 160
diff changeset
32 'repourl': test_util.fileurl(self.repo_path),
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 'branch': 'branches/the_branch',
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 'rev': 5,
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 })
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 self.assertEqual(u.stream.getvalue(), expected)
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 hg.update(self.repo, 'default')
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 u = ui.ui()
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 utility_commands.run_svn_info(u, self.repo, self.wc_path)
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 expected = (expected_info_output %
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 {'date': '2008-10-08 01:39:29 +0000 (Wed, 08 Oct 2008)',
178
33ebdcb75bcd test_utility_commands: fix normalized URL references under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 160
diff changeset
42 'repourl': test_util.fileurl(self.repo_path),
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 'branch': 'trunk',
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 'rev': 6,
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 })
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 self.assertEqual(u.stream.getvalue(), expected)
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47
157
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
48 def test_parent_output(self):
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
49 self._load_fixture_and_fetch('two_heads.svndump')
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
50 u = ui.ui()
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
51 parents = (self.repo['the_branch'].node(), revlog.nullid, )
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
52 def filectxfn(repo, memctx, path):
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
53 return context.memfilectx(path=path,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
54 data='added',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
55 islink=False,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
56 isexec=False,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
57 copied=False)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
58 ctx = context.memctx(self.repo,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
59 parents,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
60 'automated test',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
61 ['added_bogus_file', 'other_added_file', ],
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
62 filectxfn,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
63 'testy',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
64 '2008-12-21 16:32:00 -0500',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
65 {'branch': 'localbranch', })
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
66 new = self.repo.commitctx(ctx)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
67 hg.update(self.repo, new)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
68 utility_commands.print_parent_revision(u, self.repo, self.wc_path)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
69 self.assert_(node.hex(self.repo['the_branch'].node())[:8] in
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
70 u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
71 self.assert_('the_branch' in u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
72 self.assert_('r5' in u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
73 hg.update(self.repo, 'default')
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
74 u = ui.ui()
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
75 utility_commands.print_parent_revision(u, self.repo, self.wc_path)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
76 self.assert_(node.hex(self.repo['default'].node())[:8] in
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
77 u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
78 self.assert_('trunk' in u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
79 self.assert_('r6' in u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
80
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
81 def test_outgoing_output(self):
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
82 self._load_fixture_and_fetch('two_heads.svndump')
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
83 u = ui.ui()
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
84 parents = (self.repo['the_branch'].node(), revlog.nullid, )
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
85 def filectxfn(repo, memctx, path):
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
86 return context.memfilectx(path=path,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
87 data='added',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
88 islink=False,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
89 isexec=False,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
90 copied=False)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
91 ctx = context.memctx(self.repo,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
92 parents,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
93 'automated test',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
94 ['added_bogus_file', 'other_added_file', ],
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
95 filectxfn,
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
96 'testy',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
97 '2008-12-21 16:32:00 -0500',
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
98 {'branch': 'localbranch', })
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
99 new = self.repo.commitctx(ctx)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
100 hg.update(self.repo, new)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
101 utility_commands.show_outgoing_to_svn(u, self.repo, self.wc_path)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
102 self.assert_(node.hex(self.repo['localbranch'].node())[:8] in
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
103 u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
104 self.assert_('testy' in u.stream.getvalue())
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
105 hg.update(self.repo, 'default')
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
106 u = ui.ui()
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
107 utility_commands.show_outgoing_to_svn(u, self.repo, self.wc_path)
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
108 self.assertEqual(u.stream.getvalue(), 'No outgoing changes found.\n')
91541523ea5c utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents: 153
diff changeset
109
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 def test_url_output(self):
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
111 self._load_fixture_and_fetch('two_revs.svndump')
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
112 hg.update(self.repo, 'tip')
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
113 u = ui.ui()
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
114 utility_commands.print_wc_url(u, self.repo, self.wc_path)
178
33ebdcb75bcd test_utility_commands: fix normalized URL references under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 160
diff changeset
115 expected = test_util.fileurl(self.repo_path) + '\n'
139
89a737852d33 utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
116 self.assertEqual(u.stream.getvalue(), expected)
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
117
149
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
118 def test_rebase(self):
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
119 self._load_fixture_and_fetch('two_revs.svndump')
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
120 parents = (self.repo[0].node(), revlog.nullid, )
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
121 def filectxfn(repo, memctx, path):
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
122 return context.memfilectx(path=path,
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
123 data='added',
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
124 islink=False,
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
125 isexec=False,
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
126 copied=False)
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
127 ctx = context.memctx(self.repo,
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
128 parents,
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
129 'automated test',
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
130 ['added_bogus_file', 'other_added_file', ],
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
131 filectxfn,
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
132 'testy',
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
133 '2008-12-21 16:32:00 -0500',
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
134 {'branch': 'localbranch', })
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
135 self.repo.commitctx(ctx)
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
136 self.assertEqual(self.repo['tip'].branch(), 'localbranch')
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
137 beforerebasehash = self.repo['tip'].node()
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
138 hg.update(self.repo, 'tip')
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
139 utility_commands.rebase_commits(ui.ui(), self.repo, os.path.dirname(self.repo.path))
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
140 self.assertEqual(self.repo['tip'].branch(), 'localbranch')
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
141 self.assertEqual(self.repo['tip'].parents()[0].parents()[0], self.repo[0])
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
142 self.assertNotEqual(beforerebasehash, self.repo['tip'].node())
04800fda7af5 rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents: 140
diff changeset
143
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
144 def test_url_is_normalized(self):
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
145 """Verify url gets normalized on initial clone.
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
146 """
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
147 test_util.load_svndump_fixture(self.repo_path, 'two_revs.svndump')
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
148 fetch_command.fetch_revisions(ui.ui(),
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
149 svn_url=test_util.fileurl(self.repo_path)+'/',
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
150 hg_repo_path=self.wc_path,
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
151 stupid=False)
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
152 hg.update(self.repo, 'tip')
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
153 u = ui.ui()
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
154 utility_commands.print_wc_url(u, self.repo, self.wc_path)
178
33ebdcb75bcd test_utility_commands: fix normalized URL references under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 160
diff changeset
155 expected = test_util.fileurl(self.repo_path) + '\n'
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.
Augie Fackler <durin42@gmail.com>
parents: 139
diff changeset
156 self.assertEqual(u.stream.getvalue(), expected)
153
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
157
199
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
158 def test_genignore(self):
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
159 """Verify url gets normalized on initial clone.
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
160 """
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
161 test_util.load_svndump_fixture(self.repo_path, 'ignores.svndump')
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
162 fetch_command.fetch_revisions(ui.ui(),
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
163 svn_url=test_util.fileurl(self.repo_path)+'/',
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
164 hg_repo_path=self.wc_path,
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
165 stupid=False)
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
166 hg.update(self.repo, 'tip')
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
167 u = ui.ui()
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
168 utility_commands.generate_ignore(u, self.repo, self.wc_path)
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
169 self.assertEqual(open(os.path.join(self.wc_path, '.hgignore')).read(),
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
170 '.hgignore\nsyntax:glob\nblah\notherblah\nbaz/magic\n')
91db8fc049b0 Add a genignore utility command that generates an hgignore file by scraping svn:ignore properties.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
171
153
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
172
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
173 def suite():
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
174 all = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
175 ]
46f6b872c988 tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents: 149
diff changeset
176 return unittest.TestSuite(all)