~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Tests for the update command of bzr."""
19
19
 
20
20
import os
21
 
import re
22
21
 
23
22
from bzrlib import (
24
23
    branch,
25
24
    bzrdir,
26
25
    osutils,
27
26
    tests,
28
 
    urlutils,
29
27
    workingtree,
30
28
    )
31
29
from bzrlib.tests.script import ScriptRunner
196
194
 
197
195
        self.build_tree(['checkout1/'])
198
196
        checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
199
 
        branch.BranchReferenceFormat().initialize(checkout_dir,
200
 
            target_branch=master.branch)
 
197
        checkout_dir.set_branch_reference(master.branch)
201
198
        checkout1 = checkout_dir.create_workingtree('m1')
202
199
 
203
200
        # Create a second branch, with an extra commit
253
250
 
254
251
        self.build_tree(['checkout1/'])
255
252
        checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
256
 
        branch.BranchReferenceFormat().initialize(checkout_dir,
257
 
            target_branch=master.branch)
 
253
        checkout_dir.set_branch_reference(master.branch)
258
254
        checkout1 = checkout_dir.create_workingtree('m1')
259
255
 
260
256
        # Create a second branch, with an extra commit
302
298
''')
303
299
        self.assertPathExists('./file1')
304
300
        self.assertPathDoesNotExist('./file2')
305
 
        self.assertEquals(['m1'], master.get_parent_ids())
 
301
        self.assertEqual(['m1'], master.get_parent_ids())
306
302
 
307
303
    def test_update_dash_r_outside_history(self):
308
304
        """Ensure that we can update -r to dotted revisions.
456
452
>>>>>>> MERGE-SOURCE
457
453
''',
458
454
                             'lightweight/file')
 
455
 
 
456
 
 
457
    def test_no_upgrade_single_file(self):
 
458
        """There's one basis revision per tree.
 
459
 
 
460
        Since you can't actually change the basis for a single file at the
 
461
        moment, we don't let you think you can.
 
462
 
 
463
        See bug 557886.
 
464
        """
 
465
        self.make_branch_and_tree('.')
 
466
        self.build_tree_contents([('a/',),
 
467
            ('a/file', 'content')])
 
468
        sr = ScriptRunner()
 
469
        sr.run_script(self, '''
 
470
            $ bzr update ./a
 
471
            2>bzr: ERROR: bzr update can only update a whole tree, not a file or subdirectory
 
472
            $ bzr update ./a/file
 
473
            2>bzr: ERROR: bzr update can only update a whole tree, not a file or subdirectory
 
474
            $ bzr update .
 
475
            2>Tree is up to date at revision 0 of branch ...
 
476
            $ cd a
 
477
            $ bzr update .
 
478
            2>bzr: ERROR: bzr update can only update a whole tree, not a file or subdirectory
 
479
            # however, you can update the whole tree from a subdirectory
 
480
            $ bzr update
 
481
            2>Tree is up to date at revision 0 of branch ...
 
482
            ''')