~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-06-18 02:21:57 UTC
  • mfrom: (1787 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1794.
  • Revision ID: john@arbash-meinel.com-20060618022157-6e33aa9b67c25e4f
[merge] bzr.dev 1787

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.repository import RepositoryFormatKnit1
28
28
from bzrlib.tests.blackbox import ExternalBase
29
29
from bzrlib.uncommit import uncommit
30
 
from bzrlib.urlutils import local_path_from_url
31
30
from bzrlib.workingtree import WorkingTree
32
31
 
33
32
 
53
52
        tree_b.commit('commit c')
54
53
        # initial push location must be empty
55
54
        self.assertEqual(None, branch_b.get_push_location())
56
 
 
57
55
        # test push for failure without push location set
58
56
        os.chdir('branch_a')
59
57
        out = self.runbzr('push', retcode=3)
60
58
        self.assertEquals(out,
61
59
                ('','bzr: ERROR: No push location known or specified.\n'))
62
 
 
63
 
        # test not remembered if cannot actually push
64
 
        self.run_bzr('push', '../path/which/doesnt/exist', retcode=3)
65
 
        out = self.run_bzr('push', retcode=3)
66
 
        self.assertEquals(
67
 
                ('', 'bzr: ERROR: No push location known or specified.\n'),
68
 
                out)
69
 
 
70
60
        # test implicit --remember when no push location set, push fails
71
 
        out = self.run_bzr('push', '../branch_b', retcode=3)
 
61
        out = self.runbzr('push ../branch_b', retcode=3)
72
62
        self.assertEquals(out,
73
63
                ('','bzr: ERROR: These branches have diverged.  '
74
64
                    'Try a merge then push with overwrite.\n'))
75
65
        self.assertEquals(abspath(branch_a.get_push_location()),
76
66
                          abspath(branch_b.bzrdir.root_transport.base))
77
 
 
78
67
        # test implicit --remember after resolving previous failure
79
68
        uncommit(branch=branch_b, tree=tree_b)
80
69
        transport.delete('branch_b/c')
81
 
        out = self.run_bzr('push')
82
 
        path = branch_a.get_push_location()
83
 
        self.assertEquals(('Using saved location: %s\n' 
84
 
                           % (local_path_from_url(path),)
85
 
                          , 'All changes applied successfully.\n'
86
 
                            '1 revision(s) pushed.\n'), out)
87
 
        self.assertEqual(path,
88
 
                         branch_b.bzrdir.root_transport.base)
 
70
        self.runbzr('push')
 
71
        self.assertEquals(abspath(branch_a.get_push_location()),
 
72
                          abspath(branch_b.bzrdir.root_transport.base))
89
73
        # test explicit --remember
90
 
        self.run_bzr('push', '../branch_c', '--remember')
91
 
        self.assertEquals(branch_a.get_push_location(),
92
 
                          branch_c.bzrdir.root_transport.base)
 
74
        self.runbzr('push ../branch_c --remember')
 
75
        self.assertEquals(abspath(branch_a.get_push_location()),
 
76
                          abspath(branch_c.bzrdir.root_transport.base))
93
77
    
94
78
    def test_push_without_tree(self):
95
79
        # bzr push from a branch that does not have a checkout should work.