Mercurial > hgsubversion
annotate tests/test_utility_commands.py @ 174:f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 02 Jan 2009 15:54:05 -0600 |
parents | 7a5a0b5c8e34 |
children | 33ebdcb75bcd |
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 import urllib # for url quoting |
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 |
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 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
|
6 from mercurial import hg |
149
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
7 from mercurial import revlog |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
8 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
|
9 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
|
10 |
89a737852d33
utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 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
|
12 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
|
13 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
|
14 |
89a737852d33
utility_commands: Add tests for url and info. Fix a bad mock in the process.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 expected_info_output = '''URL: file://%(repo)s/%(branch)s |
160
7a5a0b5c8e34
info: Actually determine and show the repo root.
Augie Fackler <durin42@gmail.com>
parents:
157
diff
changeset
|
16 Repository Root: file://%(repo)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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 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
|
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 |
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 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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 {'date': '2008-10-08 01:39:05 +0000 (Wed, 08 Oct 2008)', |
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 'repo': urllib.quote(self.repo_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
|
34 '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
|
35 '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
|
36 }) |
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 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
|
38 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
|
39 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
|
40 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
|
41 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
|
42 {'date': '2008-10-08 01:39:29 +0000 (Wed, 08 Oct 2008)', |
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 'repo': urllib.quote(self.repo_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
|
44 '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
|
45 '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
|
46 }) |
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 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
|
48 |
157
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
49 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
|
50 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
|
51 u = ui.ui() |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 data='added', |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
56 islink=False, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
57 isexec=False, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
58 copied=False) |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
59 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
|
60 parents, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
61 'automated test', |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
62 ['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
|
63 filectxfn, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
64 'testy', |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
65 '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
|
66 {'branch': 'localbranch', }) |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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_('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
|
73 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
|
74 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
|
75 u = ui.ui() |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
76 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
|
77 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
|
78 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_('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
|
80 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
|
81 |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
82 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
|
83 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
|
84 u = ui.ui() |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
85 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
|
86 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
|
87 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
|
88 data='added', |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
89 islink=False, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
90 isexec=False, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
91 copied=False) |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
92 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
|
93 parents, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
94 'automated test', |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
95 ['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
|
96 filectxfn, |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
97 'testy', |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
98 '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
|
99 {'branch': 'localbranch', }) |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
100 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
|
101 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
|
102 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
|
103 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
|
104 u.stream.getvalue()) |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
105 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
|
106 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
|
107 u = ui.ui() |
91541523ea5c
utility_commands: Test outgoing and fix it to work again.
Augie Fackler <durin42@gmail.com>
parents:
153
diff
changeset
|
108 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
|
109 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
|
110 |
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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 utility_commands.print_wc_url(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
|
116 expected = 'file://%s\n' % urllib.quote(self.repo_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
|
117 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
|
118 |
149
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
119 def test_rebase(self): |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
120 self._load_fixture_and_fetch('two_revs.svndump') |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
121 parents = (self.repo[0].node(), revlog.nullid, ) |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
122 def filectxfn(repo, memctx, path): |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
123 return context.memfilectx(path=path, |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
124 data='added', |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
125 islink=False, |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
126 isexec=False, |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
127 copied=False) |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
128 ctx = context.memctx(self.repo, |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
129 parents, |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
130 'automated test', |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
131 ['added_bogus_file', 'other_added_file', ], |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
132 filectxfn, |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
133 'testy', |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
134 '2008-12-21 16:32:00 -0500', |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
135 {'branch': 'localbranch', }) |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
136 self.repo.commitctx(ctx) |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
137 self.assertEqual(self.repo['tip'].branch(), 'localbranch') |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
138 beforerebasehash = self.repo['tip'].node() |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
139 hg.update(self.repo, 'tip') |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
140 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
|
141 self.assertEqual(self.repo['tip'].branch(), 'localbranch') |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
142 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
|
143 self.assertNotEqual(beforerebasehash, self.repo['tip'].node()) |
04800fda7af5
rebase: preserve local branch names.
Augie Fackler <durin42@gmail.com>
parents:
140
diff
changeset
|
144 |
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
|
145 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
|
146 """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
|
147 """ |
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 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 utility_commands.print_wc_url(u, self.repo, 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
|
156 expected = 'file://%s\n' % urllib.quote(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
|
157 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
|
158 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
159 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
160 def suite(): |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
161 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
|
162 ] |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
149
diff
changeset
|
163 return unittest.TestSuite(all) |