~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_pull.py

  • Committer: Michael Hudson
  • Date: 2007-11-26 13:45:49 UTC
  • mto: (3008.1.10 tree-less-merge-diffs)
  • mto: This revision was merged to the branch mainline in revision 3189.
  • Revision ID: michael.hudson@canonical.com-20071126134549-8l3hqyg2bie5yqdv
extract merger creation into a method

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import sys
22
22
 
23
23
from bzrlib.branch import Branch
24
 
from bzrlib.directory_service import directories
25
24
from bzrlib.osutils import pathjoin
26
25
from bzrlib.tests.blackbox import ExternalBase
27
26
from bzrlib.uncommit import uncommit
306
305
        self.assertContainsRe(out, 'bar')
307
306
        self.assertNotContainsRe(out, 'added:')
308
307
        self.assertNotContainsRe(out, 'foo')
309
 
 
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'])
314
 
        tree_a.add('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'])
322
 
        tree_a.add('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)
328
 
 
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"""
336
 
 
337
 
            def look_up(self, name, url):
338
 
                return 'source'
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())
343
 
 
344
 
    def test_pull_verbose_defaults_to_long(self):
345
 
        tree = self.example_branch('source')
346
 
        target = self.make_branch_and_tree('target')
347
 
        out = self.run_bzr('pull -v source -d target')[0]
348
 
        self.assertContainsRe(out,
349
 
                              r'revno: 1\ncommitter: .*\nbranch nick: source')
350
 
        self.assertNotContainsRe(out, r'\n {4}1 .*\n {6}setup\n')
351
 
 
352
 
    def test_pull_verbose_uses_default_log(self):
353
 
        tree = self.example_branch('source')
354
 
        target = self.make_branch_and_tree('target')
355
 
        target_config = target.branch.get_config()
356
 
        target_config.set_user_option('log_format', 'short')
357
 
        out = self.run_bzr('pull -v source -d target')[0]
358
 
        self.assertContainsRe(out, r'\n {4}1 .*\n {6}setup\n')
359
 
        self.assertNotContainsRe(
360
 
            out, r'revno: 1\ncommitter: .*\nbranch nick: source')