~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2007-03-28 07:08:42 UTC
  • mfrom: (2380 +trunk)
  • mto: (2018.5.146 hpss)
  • mto: This revision was merged to the branch mainline in revision 2414.
  • Revision ID: andrew.bennetts@canonical.com-20070328070842-r843houy668oxb9o
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
2
 
# -*- coding: utf-8 -*-
 
1
# Copyright (C) 2005, 2007 Canonical Ltd
3
2
#
4
3
# This program is free software; you can redistribute it and/or modify
5
4
# it under the terms of the GNU General Public License as published by
22
21
 
23
22
from bzrlib import (
24
23
    errors,
 
24
    urlutils,
25
25
    )
26
 
import bzrlib
27
26
from bzrlib.branch import Branch
28
27
from bzrlib.bzrdir import BzrDirMetaFormat1
29
28
from bzrlib.osutils import abspath
30
 
from bzrlib.repository import RepositoryFormatKnit1
 
29
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
31
30
from bzrlib.tests.blackbox import ExternalBase
32
31
from bzrlib.uncommit import uncommit
33
32
from bzrlib.urlutils import local_path_from_url
81
80
        # test implicit --remember after resolving previous failure
82
81
        uncommit(branch=branch_b, tree=tree_b)
83
82
        transport.delete('branch_b/c')
84
 
        out = self.run_bzr('push')
 
83
        out, err = self.run_bzr('push')
85
84
        path = branch_a.get_push_location()
86
 
        self.assertEquals(('Using saved location: %s\n' 
87
 
                           % (local_path_from_url(path),)
88
 
                          , 'All changes applied successfully.\n'
89
 
                            '1 revision(s) pushed.\n'), out)
 
85
        self.assertEquals(out,
 
86
                          'Using saved location: %s\n' 
 
87
                          'Pushed up to revision 2.\n'
 
88
                          % local_path_from_url(path))
 
89
        self.assertEqual(err,
 
90
                         'All changes applied successfully.\n')
90
91
        self.assertEqual(path,
91
92
                         branch_b.bzrdir.root_transport.base)
92
93
        # test explicit --remember
99
100
        b = self.make_branch('.')
100
101
        out, err = self.run_bzr('push', 'pushed-location')
101
102
        self.assertEqual('', out)
102
 
        self.assertEqual('0 revision(s) pushed.\n', err)
103
 
        b2 = bzrlib.branch.Branch.open('pushed-location')
 
103
        self.assertEqual('Created new branch.\n', err)
 
104
        b2 = Branch.open('pushed-location')
104
105
        self.assertEndsWith(b2.base, 'pushed-location/')
105
106
 
106
107
    def test_push_new_branch_revision_count(self):
115
116
        out, err = self.run_bzr('push', 'pushed-to')
116
117
        os.chdir('..')
117
118
        self.assertEqual('', out)
118
 
        self.assertEqual('1 revision(s) pushed.\n', err)
 
119
        self.assertEqual('Created new branch.\n', err)
119
120
 
120
121
    def test_push_only_pushes_history(self):
121
122
        # Knit branches should only push the history for the current revision.
164
165
        t.commit('commit filename')
165
166
        self.run_bzr('push', '../new-tree')
166
167
 
 
168
    def test_push_dash_d(self):
 
169
        t = self.make_branch_and_tree('from')
 
170
        t.commit(allow_pointless=True,
 
171
                message='first commit')
 
172
        self.runbzr('push -d from to-one')
 
173
        self.failUnlessExists('to-one')
 
174
        self.runbzr('push -d %s %s' 
 
175
            % tuple(map(urlutils.local_path_to_url, ['from', 'to-two'])))
 
176
        self.failUnlessExists('to-two')
 
177
 
167
178
    def create_simple_tree(self):
168
179
        tree = self.make_branch_and_tree('tree')
169
180
        self.build_tree(['tree/a'])