~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2006-07-30 16:43:12 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060730164312-b025fd3ff0cee59e
rename  gpl.txt => COPYING.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
 
2
# -*- coding: utf-8 -*-
2
3
#
3
4
# This program is free software; you can redistribute it and/or modify
4
5
# it under the terms of the GNU General Public License as published by
23
24
from bzrlib.branch import Branch
24
25
from bzrlib.tests.blackbox import ExternalBase
25
26
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
 
 
112
99
    def test_pull_revision(self):
113
100
        """Pull some changes from one branch to another."""
114
101
        os.mkdir('a')
260
247
        tree_b.commit('commit d')
261
248
        out = self.runbzr('pull ../branch_a', retcode=3)
262
249
        self.assertEquals(out,
263
 
                ('','bzr: ERROR: These branches have diverged.'
264
 
                    ' Use the merge command to reconcile them.\n'))
 
250
                ('','bzr: ERROR: These branches have diverged.  Use the merge command to reconcile them.\n'))
265
251
        self.assertEquals(branch_b.get_parent(), parent)
266
252
        # test implicit --remember after resolving previous failure
267
253
        uncommit(branch=branch_b, tree=tree_b)
298
284
        bundle_file.close()
299
285
 
300
286
        os.chdir('../branch_b')
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')
 
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])
306
291
 
307
292
        self.assertEqualDiff(tree_a.branch.revision_history(),
308
293
                             tree_b.branch.revision_history())
309
294
 
310
 
        testament_a = Testament.from_revision(tree_a.branch.repository,
311
 
                                              tree_a.get_parent_ids()[0])
 
295
        testament_a = Testament.from_revision(tree_a.branch.repository, 
 
296
                                              tree_a.last_revision())
312
297
        testament_b = Testament.from_revision(tree_b.branch.repository,
313
 
                                              tree_b.get_parent_ids()[0])
 
298
                                              tree_b.last_revision())
314
299
        self.assertEqualDiff(testament_a.as_text(),
315
300
                             testament_b.as_text())
316
301
 
317
302
        # it is legal to attempt to pull an already-merged bundle
318
 
        out, err = self.run_bzr('pull', '../bundle')
319
 
        self.assertEqual(err, '')
320
 
        self.assertEqual(out, 'No revisions to pull.\n')
 
303
        output = self.run_bzr('pull', '../bundle')
 
304
        self.assertEqual('', output[0])
 
305
        self.assertEqual('0 revision(s) pulled.\n', output[1])