27
27
class TestMissing(TestCaseWithTransport):
29
def assertMessages(self, out, must_have=(), must_not_have=()):
30
"""Check if commit messages are in or not in the output"""
32
self.assertContainsRe(out, r'\nmessage:\n %s\n' % m)
33
for m in must_not_have:
34
self.assertNotContainsRe(out, r'\nmessage:\n %s\n' % m)
29
36
def test_missing_quiet(self):
30
37
# <https://bugs.launchpad.net/bzr/+bug/284748>
31
38
# create a source branch
137
144
self.assertEqualDiff('Other branch is up to date.\n',
138
145
self.run_bzr('missing ../a --theirs-only')[0])
147
def test_missing_filtered(self):
148
# create a source branch
149
a_tree = self.make_branch_and_tree('a')
150
self.build_tree_contents([('a/a', 'initial\n')])
152
a_tree.commit(message='r1')
153
# clone and add differing revisions
154
b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
156
for i in range(2, 6):
157
a_tree.commit(message='a%d' % i)
158
b_tree.commit(message='b%d' % i)
162
out,err = self.run_bzr('missing ../b --my-revision 3', retcode=1)
163
self.assertMessages(out, ('a3', 'b2', 'b3', 'b4', 'b5'), ('a2', 'a4'))
165
out,err = self.run_bzr('missing ../b --my-revision 3..4', retcode=1)
166
self.assertMessages(out, ('a3', 'a4'), ('a2', 'a5'))
169
out,err = self.run_bzr('missing ../b -r 3', retcode=1)
170
self.assertMessages(out, ('a2', 'a3', 'a4', 'a5', 'b3'), ('b2', 'b4'))
172
out,err = self.run_bzr('missing ../b -r 3..4', retcode=1)
173
self.assertMessages(out, ('b3', 'b4'), ('b2', 'b5'))
176
out,err = self.run_bzr('missing ../b --my-revision 3..4 -r 3..4',
178
self.assertMessages(out, ('a3', 'a4', 'b3', 'b4'),
179
('a2', 'a5', 'b2', 'b5'))
140
181
def test_missing_check_last_location(self):
141
182
# check that last location shown as filepath not file URL