117
119
out, err = self.run_bzr('revno --tree checkout_b')
118
120
self.assertEqual('', err)
119
121
self.assertEqual('???\n', out)
123
def test_revno_with_revision(self):
124
wt = self.make_branch_and_tree('.')
125
revid1 = wt.commit('rev1')
126
revid2 = wt.commit('rev2')
128
out, err = self.run_bzr('revno -r-2 .')
129
self.assertEqual('1\n', out)
131
out, err = self.run_bzr('revno -rrevid:%s .' % revid1)
132
self.assertEqual('1\n', out)
134
def test_revno_and_tree_mutually_exclusive(self):
135
wt = self.make_branch_and_tree('.')
136
out, err = self.run_bzr('revno -r-2 --tree .', retcode=3)
137
self.assertEqual('', out)
139
'bzr: ERROR: --tree and --revision can not be used together\n',
143
class TestSmartServerRevno(tests.TestCaseWithTransport):
145
def test_simple_branch_revno(self):
146
self.setup_smart_server_with_call_log()
147
t = self.make_branch_and_tree('branch')
148
self.build_tree_contents([('branch/foo', 'thecontents')])
150
revid = t.commit("message")
151
self.reset_smart_call_log()
152
out, err = self.run_bzr(['revno', self.get_url('branch')])
153
# This figure represent the amount of work to perform this use case. It
154
# is entirely ok to reduce this number if a test fails due to rpc_count
155
# being too low. If rpc_count increases, more network roundtrips have
156
# become necessary for this use case. Please do not adjust this number
157
# upwards without agreement from bzr's network support maintainers.
158
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
159
self.assertLength(6, self.hpss_calls)
161
def test_simple_branch_revno_lookup(self):
162
self.setup_smart_server_with_call_log()
163
t = self.make_branch_and_tree('branch')
164
self.build_tree_contents([('branch/foo', 'thecontents')])
166
revid1 = t.commit("message")
167
revid2 = t.commit("message")
168
self.reset_smart_call_log()
169
out, err = self.run_bzr(['revno', '-rrevid:' + revid1,
170
self.get_url('branch')])
171
# This figure represent the amount of work to perform this use case. It
172
# is entirely ok to reduce this number if a test fails due to rpc_count
173
# being too low. If rpc_count increases, more network roundtrips have
174
# become necessary for this use case. Please do not adjust this number
175
# upwards without agreement from bzr's network support maintainers.
176
self.assertLength(5, self.hpss_calls)
177
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)