~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge 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, 2006 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
24
23
from bzrlib.branch import Branch
25
24
from bzrlib.tests.blackbox import ExternalBase
26
25
from bzrlib.uncommit import uncommit
 
26
from bzrlib import urlutils
27
27
 
28
28
 
29
29
class TestPull(ExternalBase):
96
96
        self.runbzr('pull ../b')
97
97
        self.runbzr('pull ../b')
98
98
 
 
99
    def test_pull_dash_d(self):
 
100
        os.mkdir('a')
 
101
        os.chdir('a')
 
102
        self.example_branch()
 
103
        self.runbzr('init ../b')
 
104
        self.runbzr('init ../c')
 
105
        # pull into that branch
 
106
        self.runbzr('pull -d ../b .')
 
107
        # pull into a branch specified by a url
 
108
        c_url = urlutils.local_path_to_url('../c')
 
109
        self.assertStartsWith(c_url, 'file://')
 
110
        self.runbzr('pull -d %s .' % c_url)
 
111
 
99
112
    def test_pull_revision(self):
100
113
        """Pull some changes from one branch to another."""
101
114
        os.mkdir('a')
247
260
        tree_b.commit('commit d')
248
261
        out = self.runbzr('pull ../branch_a', retcode=3)
249
262
        self.assertEquals(out,
250
 
                ('','bzr: ERROR: These branches have diverged.  Use the merge command to reconcile them.\n'))
 
263
                ('','bzr: ERROR: These branches have diverged.'
 
264
                    ' Use the merge command to reconcile them.\n'))
251
265
        self.assertEquals(branch_b.get_parent(), parent)
252
266
        # test implicit --remember after resolving previous failure
253
267
        uncommit(branch=branch_b, tree=tree_b)
284
298
        bundle_file.close()
285
299
 
286
300
        os.chdir('../branch_b')
287
 
        output = self.run_bzr('pull', '../bundle')
288
 
        self.assertEqual('', output[0])
289
 
        self.assertEqual('All changes applied successfully.\n'
290
 
                         '1 revision(s) pulled.\n', output[1])
 
301
        out, err = self.run_bzr('pull', '../bundle')
 
302
        self.assertEqual(out,
 
303
                         'Now on revision 2.\n')
 
304
        self.assertEqual(err,
 
305
                ' M  a\nAll changes applied successfully.\n')
291
306
 
292
307
        self.assertEqualDiff(tree_a.branch.revision_history(),
293
308
                             tree_b.branch.revision_history())
300
315
                             testament_b.as_text())
301
316
 
302
317
        # it is legal to attempt to pull an already-merged bundle
303
 
        output = self.run_bzr('pull', '../bundle')
304
 
        self.assertEqual('', output[0])
305
 
        self.assertEqual('0 revision(s) pulled.\n', output[1])
 
318
        out, err = self.run_bzr('pull', '../bundle')
 
319
        self.assertEqual(err, '')
 
320
        self.assertEqual(out, 'No revisions to pull.\n')