~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Packman
  • Date: 2011-10-14 18:42:17 UTC
  • mto: This revision was merged to the branch mainline in revision 6235.
  • Revision ID: martin.packman@canonical.com-20111014184217-2fmnziqqo4duhgbz
Remove unneeded _LRUNode.cleanup callback ability and deprecate LRUCache.add

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,
25
26
    errors,
26
27
    osutils,
27
28
    tests,
35
36
    blackbox,
36
37
    http_server,
37
38
    scenarios,
 
39
    script,
38
40
    test_foreign,
39
41
    test_server,
40
42
    )
104
106
        transport.delete('branch_b/c')
105
107
        out, err = self.run_bzr('push', working_dir='branch_a')
106
108
        path = branch_a.get_push_location()
107
 
        self.assertEquals(out,
108
 
                          'Using saved push location: %s\n'
109
 
                          % urlutils.local_path_from_url(path))
110
109
        self.assertEqual(err,
 
110
                         'Using saved push location: %s\n'
111
111
                         'All changes applied successfully.\n'
112
 
                         'Pushed up to revision 2.\n')
 
112
                         'Pushed up to revision 2.\n'
 
113
                         % urlutils.local_path_from_url(path))
113
114
        self.assertEqual(path,
114
115
                         branch_b.bzrdir.root_transport.base)
115
116
        # test explicit --remember
149
150
        self.assertEqual('', out)
150
151
        self.assertEqual('Created new branch.\n', err)
151
152
 
 
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
 
152
169
    def test_push_only_pushes_history(self):
153
170
        # Knit branches should only push the history for the current revision.
154
171
        format = bzrdir.BzrDirMetaFormat1()
158
175
 
159
176
        def make_shared_tree(path):
160
177
            shared_repo.bzrdir.root_transport.mkdir(path)
161
 
            shared_repo.bzrdir.create_branch_convenience('repo/' + path)
 
178
            controldir.ControlDir.create_branch_convenience('repo/' + path)
162
179
            return workingtree.WorkingTree.open('repo/' + path)
163
180
        tree_a = make_shared_tree('a')
164
181
        self.build_tree(['repo/a/file'])
661
678
    def set_config_push_strict(self, value):
662
679
        # set config var (any of bazaar.conf, locations.conf, branch.conf
663
680
        # should do)
664
 
        conf = self.tree.branch.get_config()
665
 
        conf.set_user_option('push_strict', value)
 
681
        conf = self.tree.branch.get_config_stack()
 
682
        conf.set('push_strict', value)
666
683
 
667
684
    _default_command = ['push', '../to']
668
685
    _default_wd = 'local'
827
844
        self.assertEquals("", output)
828
845
        self.assertEquals(error, "bzr: ERROR: It is not possible to losslessly"
829
846
            " 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
            """)