23
23
from bzrlib.branch import Branch
24
from bzrlib.directory_service import directories
24
25
from bzrlib.osutils import pathjoin
25
26
from bzrlib.tests.blackbox import ExternalBase
26
27
from bzrlib.uncommit import uncommit
305
306
self.assertContainsRe(out, 'bar')
306
307
self.assertNotContainsRe(out, 'added:')
307
308
self.assertNotContainsRe(out, 'foo')
310
def test_pull_quiet(self):
311
"""Check that bzr pull --quiet does not print anything"""
312
tree_a = self.make_branch_and_tree('tree_a')
313
self.build_tree(['tree_a/foo'])
315
revision_id = tree_a.commit('bar')
316
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
317
out, err = self.run_bzr('pull --quiet -d tree_b')
318
self.assertEqual(out, '')
319
self.assertEqual(err, '')
320
self.assertEqual(tree_b.last_revision(), revision_id)
321
self.build_tree(['tree_a/moo'])
323
revision_id = tree_a.commit('quack')
324
out, err = self.run_bzr('pull --quiet -d tree_b')
325
self.assertEqual(out, '')
326
self.assertEqual(err, '')
327
self.assertEqual(tree_b.last_revision(), revision_id)
329
def test_pull_from_directory_service(self):
330
source = self.make_branch_and_tree('source')
331
source.commit('commit 1')
332
target = source.bzrdir.sprout('target').open_workingtree()
333
source_last = source.commit('commit 2')
334
class FooService(object):
335
"""A directory service that always returns source"""
337
def look_up(self, name, url):
339
directories.register('foo:', FooService, 'Testing directory service')
340
self.addCleanup(lambda: directories.remove('foo:'))
341
self.run_bzr('pull foo:bar -d target')
342
self.assertEqual(source_last, target.last_revision())