~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2011-02-10 12:37:27 UTC
  • mto: This revision was merged to the branch mainline in revision 5661.
  • Revision ID: v.ladeuil+lp@free.fr-20110210123727-8e0pu4wtlt6fj7nf
thread is already a python module, avoid confusion and use cethread instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
29
29
from bzrlib.tests import TestCaseWithTransport
30
30
from bzrlib.tests import (
31
 
    fixtures,
32
31
    HardlinkFeature,
33
32
    test_server,
34
33
    )
35
34
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
36
 
from bzrlib.tests.script import run_script
37
35
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
38
36
from bzrlib.workingtree import WorkingTree
39
37
 
180
178
        source.add('file1')
181
179
        source.commit('added file')
182
180
        out, err = self.run_bzr('branch source target --files-from source')
183
 
        self.assertPathExists('target/file1')
 
181
        self.failUnlessExists('target/file1')
184
182
 
185
183
    def test_branch_files_from_hardlink(self):
186
184
        self.requireFeature(HardlinkFeature)
209
207
    def test_branch_no_tree(self):
210
208
        self.example_branch('source')
211
209
        self.run_bzr('branch --no-tree source target')
212
 
        self.assertPathDoesNotExist('target/hello')
213
 
        self.assertPathDoesNotExist('target/goodbye')
 
210
        self.failIfExists('target/hello')
 
211
        self.failIfExists('target/goodbye')
214
212
 
215
213
    def test_branch_into_existing_dir(self):
216
214
        self.example_branch('a')
226
224
        # force operation
227
225
        self.run_bzr('branch a b --use-existing-dir')
228
226
        # check conflicts
229
 
        self.assertPathExists('b/hello.moved')
230
 
        self.assertPathDoesNotExist('b/godbye.moved')
 
227
        self.failUnlessExists('b/hello.moved')
 
228
        self.failIfExists('b/godbye.moved')
231
229
        # we can't branch into branch
232
230
        out,err = self.run_bzr('branch a b --use-existing-dir', retcode=3)
233
231
        self.assertEqual('', out)
272
270
 
273
271
    def test_branch_fetches_all_tags(self):
274
272
        builder = self.make_branch_builder('source')
275
 
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
 
273
        builder.build_commit(message="Rev 1", rev_id='rev-1')
 
274
        builder.build_commit(message="Rev 2", rev_id='rev-2')
 
275
        source = builder.get_branch()
276
276
        source.tags.set_tag('tag-a', 'rev-2')
 
277
        source.set_last_revision_info(1, 'rev-1')
277
278
        # Now source has a tag not in its ancestry.  Make a branch from it.
278
279
        self.run_bzr('branch source new-branch')
279
280
        new_branch = branch.Branch.open('new-branch')
465
466
    def test_branch_from_branch_with_tags(self):
466
467
        self.setup_smart_server_with_call_log()
467
468
        builder = self.make_branch_builder('source')
468
 
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
 
469
        builder.build_commit(message="Rev 1", rev_id='rev-1')
 
470
        builder.build_commit(message="Rev 2", rev_id='rev-2')
 
471
        source = builder.get_branch()
469
472
        source.tags.set_tag('tag-a', 'rev-2')
470
473
        source.tags.set_tag('tag-missing', 'missing-rev')
 
474
        source.set_last_revision_info(1, 'rev-1')
471
475
        # Now source has a tag not in its ancestry.  Make a branch from it.
472
476
        self.reset_smart_call_log()
473
477
        out, err = self.run_bzr(['branch', self.get_url('source'), 'target'])
502
506
        # Ensure that no working tree what created remotely
503
507
        self.assertFalse(t.has('remote/file'))
504
508
 
505
 
 
506
 
class TestDeprecatedAliases(TestCaseWithTransport):
507
 
 
508
 
    def test_deprecated_aliases(self):
509
 
        """bzr branch can be called clone or get, but those names are deprecated.
510
 
 
511
 
        See bug 506265.
512
 
        """
513
 
        for command in ['clone', 'get']:
514
 
            run_script(self, """
515
 
            $ bzr %(command)s A B
516
 
            2>The command 'bzr %(command)s' has been deprecated in bzr 2.4. Please use 'bzr branch' instead.
517
 
            2>bzr: ERROR: Not a branch...
518
 
            """ % locals())