=== modified file 'bzrlib/builtins.py' --- bzrlib/builtins.py 2008-06-03 05:14:53 +0000 +++ bzrlib/builtins.py 2008-06-06 05:12:41 +0000 @@ -995,9 +995,13 @@ branch = dir.open_branch() except errors.NoSuchRevision: to_transport.delete_tree('.') - msg = "The branch %s has no revision %s." % (from_location, revision[0]) + msg = "The branch %s has no revision %s." % (from_location, + revision[0]) raise errors.BzrCommandError(msg) _merge_tags_if_possible(br_from, branch) + # If the source branch is shallow, the new branch may + # be shallow whether we asked for that explicitly or not. + # We therefore need a try/except here and not just 'if shallow:' try: note('Created new shallow branch referring to %s.' % branch.get_stacked_on()) === modified file 'bzrlib/tests/blackbox/test_branch.py' --- bzrlib/tests/blackbox/test_branch.py 2008-06-03 05:14:53 +0000 +++ bzrlib/tests/blackbox/test_branch.py 2008-06-06 05:12:41 +0000 @@ -98,13 +98,13 @@ self.assertEqual(source_stat, target_stat) def assertShallow(self, branch_revid, stacked_on): - """Assert that the branch 'published' has been published correctly.""" + """Assert that the branch 'newbranch' has been published correctly.""" new_branch = branch.Branch.open('newbranch') # The branch refers to the mainline self.assertEqual(stacked_on, new_branch.get_stacked_on()) # and the branch's work was pushed self.assertTrue(new_branch.repository.has_revision(branch_revid)) - # but the mainlines was not included + # but the mainline's was not included repo = new_branch.bzrdir.open_repository() self.assertEqual(1, len(repo.all_revision_ids())) @@ -133,8 +133,9 @@ trunk_tree = self.make_branch_and_tree('mainline', format='development') trunk_tree.commit('mainline') - # and make branch from it which is shallow - out, err = self.run_bzr(['branch', '--shallow', 'mainline', 'newbranch']) + # and a branch from it which is shallow + out, err = self.run_bzr(['branch', '--shallow', 'mainline', + 'newbranch']) self.assertEqual('', out) self.assertEqual('Created new shallow branch referring to %s.\n' % trunk_tree.branch.base, err)