comparison tests/test_utility_commands.py @ 157:91541523ea5c

utility_commands: Test outgoing and fix it to work again.
author Augie Fackler <durin42@gmail.com>
date Wed, 24 Dec 2008 11:12:23 -0600
parents 46f6b872c988
children 7a5a0b5c8e34
comparison
equal deleted inserted replaced
156:56dae5beae65 157:91541523ea5c
4 4
5 from mercurial import ui 5 from mercurial import ui
6 from mercurial import hg 6 from mercurial import hg
7 from mercurial import revlog 7 from mercurial import revlog
8 from mercurial import context 8 from mercurial import context
9 from mercurial import node
9 10
10 import utility_commands 11 import utility_commands
11 import fetch_command 12 import fetch_command
12 import test_util 13 import test_util
13 14
42 'repo': urllib.quote(self.repo_path), 43 'repo': urllib.quote(self.repo_path),
43 'branch': 'trunk', 44 'branch': 'trunk',
44 'rev': 6, 45 'rev': 6,
45 }) 46 })
46 self.assertEqual(u.stream.getvalue(), expected) 47 self.assertEqual(u.stream.getvalue(), expected)
48
49 def test_parent_output(self):
50 self._load_fixture_and_fetch('two_heads.svndump')
51 u = ui.ui()
52 parents = (self.repo['the_branch'].node(), revlog.nullid, )
53 def filectxfn(repo, memctx, path):
54 return context.memfilectx(path=path,
55 data='added',
56 islink=False,
57 isexec=False,
58 copied=False)
59 ctx = context.memctx(self.repo,
60 parents,
61 'automated test',
62 ['added_bogus_file', 'other_added_file', ],
63 filectxfn,
64 'testy',
65 '2008-12-21 16:32:00 -0500',
66 {'branch': 'localbranch', })
67 new = self.repo.commitctx(ctx)
68 hg.update(self.repo, new)
69 utility_commands.print_parent_revision(u, self.repo, self.wc_path)
70 self.assert_(node.hex(self.repo['the_branch'].node())[:8] in
71 u.stream.getvalue())
72 self.assert_('the_branch' in u.stream.getvalue())
73 self.assert_('r5' in u.stream.getvalue())
74 hg.update(self.repo, 'default')
75 u = ui.ui()
76 utility_commands.print_parent_revision(u, self.repo, self.wc_path)
77 self.assert_(node.hex(self.repo['default'].node())[:8] in
78 u.stream.getvalue())
79 self.assert_('trunk' in u.stream.getvalue())
80 self.assert_('r6' in u.stream.getvalue())
81
82 def test_outgoing_output(self):
83 self._load_fixture_and_fetch('two_heads.svndump')
84 u = ui.ui()
85 parents = (self.repo['the_branch'].node(), revlog.nullid, )
86 def filectxfn(repo, memctx, path):
87 return context.memfilectx(path=path,
88 data='added',
89 islink=False,
90 isexec=False,
91 copied=False)
92 ctx = context.memctx(self.repo,
93 parents,
94 'automated test',
95 ['added_bogus_file', 'other_added_file', ],
96 filectxfn,
97 'testy',
98 '2008-12-21 16:32:00 -0500',
99 {'branch': 'localbranch', })
100 new = self.repo.commitctx(ctx)
101 hg.update(self.repo, new)
102 utility_commands.show_outgoing_to_svn(u, self.repo, self.wc_path)
103 self.assert_(node.hex(self.repo['localbranch'].node())[:8] in
104 u.stream.getvalue())
105 self.assert_('testy' in u.stream.getvalue())
106 hg.update(self.repo, 'default')
107 u = ui.ui()
108 utility_commands.show_outgoing_to_svn(u, self.repo, self.wc_path)
109 self.assertEqual(u.stream.getvalue(), 'No outgoing changes found.\n')
47 110
48 def test_url_output(self): 111 def test_url_output(self):
49 self._load_fixture_and_fetch('two_revs.svndump') 112 self._load_fixture_and_fetch('two_revs.svndump')
50 hg.update(self.repo, 'tip') 113 hg.update(self.repo, 'tip')
51 u = ui.ui() 114 u = ui.ui()