~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-03 04:57:59 UTC
  • mfrom: (6042.1.2 fix-log-2)
  • Revision ID: pqm@pqm.ubuntu.com-20110803045759-1lrr8eymve8ofldr
(mbp) Log levels are no longer reset to what the log formatter supports (bug
 747958) (Thomi Richards)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib import (
23
23
    branch,
24
24
    bzrdir,
25
 
    controldir,
26
25
    errors,
27
26
    osutils,
28
27
    tests,
36
35
    blackbox,
37
36
    http_server,
38
37
    scenarios,
39
 
    script,
40
38
    test_foreign,
41
39
    test_server,
42
40
    )
106
104
        transport.delete('branch_b/c')
107
105
        out, err = self.run_bzr('push', working_dir='branch_a')
108
106
        path = branch_a.get_push_location()
 
107
        self.assertEquals(out,
 
108
                          'Using saved push location: %s\n'
 
109
                          % urlutils.local_path_from_url(path))
109
110
        self.assertEqual(err,
110
 
                         'Using saved push location: %s\n'
111
111
                         'All changes applied successfully.\n'
112
 
                         'Pushed up to revision 2.\n'
113
 
                         % urlutils.local_path_from_url(path))
 
112
                         'Pushed up to revision 2.\n')
114
113
        self.assertEqual(path,
115
114
                         branch_b.bzrdir.root_transport.base)
116
115
        # test explicit --remember
150
149
        self.assertEqual('', out)
151
150
        self.assertEqual('Created new branch.\n', err)
152
151
 
153
 
    def test_push_quiet(self):
154
 
        # test that using -q makes output quiet
155
 
        t = self.make_branch_and_tree('tree')
156
 
        self.build_tree(['tree/file'])
157
 
        t.add('file')
158
 
        t.commit('commit 1')
159
 
        self.run_bzr('push -d tree pushed-to')
160
 
        path = t.branch.get_push_location()
161
 
        out, err = self.run_bzr('push', working_dir="tree")
162
 
        self.assertEqual('Using saved push location: %s\n'
163
 
                         'No new revisions or tags to push.\n' %
164
 
                         urlutils.local_path_from_url(path), err)
165
 
        out, err = self.run_bzr('push -q', working_dir="tree")
166
 
        self.assertEqual('', out)
167
 
        self.assertEqual('', err)
168
 
 
169
152
    def test_push_only_pushes_history(self):
170
153
        # Knit branches should only push the history for the current revision.
171
154
        format = bzrdir.BzrDirMetaFormat1()
175
158
 
176
159
        def make_shared_tree(path):
177
160
            shared_repo.bzrdir.root_transport.mkdir(path)
178
 
            controldir.ControlDir.create_branch_convenience('repo/' + path)
 
161
            shared_repo.bzrdir.create_branch_convenience('repo/' + path)
179
162
            return workingtree.WorkingTree.open('repo/' + path)
180
163
        tree_a = make_shared_tree('a')
181
164
        self.build_tree(['repo/a/file'])
678
661
    def set_config_push_strict(self, value):
679
662
        # set config var (any of bazaar.conf, locations.conf, branch.conf
680
663
        # should do)
681
 
        conf = self.tree.branch.get_config_stack()
682
 
        conf.set('push_strict', value)
 
664
        conf = self.tree.branch.get_config()
 
665
        conf.set_user_option('push_strict', value)
683
666
 
684
667
    _default_command = ['push', '../to']
685
668
    _default_wd = 'local'
844
827
        self.assertEquals("", output)
845
828
        self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
846
829
            " push to dummy. You may want to use dpush instead.\n")
847
 
 
848
 
 
849
 
class TestPushOutput(script.TestCaseWithTransportAndScript):
850
 
 
851
 
    def test_push_log_format(self):
852
 
        self.run_script("""
853
 
            $ bzr init trunk
854
 
            Created a standalone tree (format: 2a)
855
 
            $ cd trunk
856
 
            $ echo foo > file
857
 
            $ bzr add
858
 
            adding file
859
 
            $ bzr commit -m 'we need some foo'
860
 
            2>Committing to:...trunk/
861
 
            2>added file
862
 
            2>Committed revision 1.
863
 
            $ bzr init ../feature
864
 
            Created a standalone tree (format: 2a)
865
 
            $ bzr push -v ../feature -Olog_format=line
866
 
            Added Revisions:
867
 
            1: jrandom@example.com ...we need some foo
868
 
            2>All changes applied successfully.
869
 
            2>Pushed up to revision 1.
870
 
            """)