pushing a new 1.9 branch stacked on a 2a branch fails leaving an empty branch behind.

Bug #393677 reported by Martin Pool
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

A project's main branch is upgraded to format 2a and Launchpad (or any server) indicates that new branches should be stacked upon it. A client then tries to push a 1.9 (or other) format branch.

What should happen:

The server returns a clean error and does not create a branch at all.

What happens today in bzr.dev is that we get an IncompatibleRepositories error and the initialised branch is left in place.

bzr 1.18 and earlier generate an 'UnknownSmartServer' error.

Martin Pool (mbp)
Changed in bzr:
importance: Undecided → High
milestone: none → 2.0
status: New → Confirmed
Martin Pool (mbp)
Changed in bzr:
assignee: nobody → Martin Pool (mbp)
Revision history for this message
Robert Collins (lifeless) wrote :

Assigning to reflect actual work :).

Changed in bzr:
assignee: Martin Pool (mbp) → nobody
Revision history for this message
Martin Pool (mbp) wrote :

I may be wrong, but I think Robert is now working on this.

Changed in bzr:
assignee: nobody → Robert Collins (lifeless)
status: Confirmed → In Progress
Changed in bzr:
milestone: 2.0 → none
Revision history for this message
Robert Collins (lifeless) wrote :

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- bzrlib/tests/blackbox/test_push.py 2009-08-20 04:09:58 +0000
+++ bzrlib/tests/blackbox/test_push.py 2009-08-27 00:21:06 +0000
@@ -278,6 +278,20 @@
         b = branch.Branch.open(self.get_url('to'))
         self.assertEqual('../stack-on', b.get_stacked_on_url())

+ def test_push_smart_with_default_stacking_1_9_on_2a_bug_393677(self):
+ # If the default stacked-on location is a 2a format repo, and the
+ # branch being pushed has a 1.9 repository the result of pushing
+ # should be a clean error: The user has to upgrade to interoperate
+ # with that project anyway.
+ self.setup_smart_server_with_call_log()
+ self.make_branch('stack-on', format='2a')
+ self.make_bzrdir('.').get_config().set_default_stack_on('stack-on')
+ self.make_branch('from', format='1.9')
+ out, err = self.run_bzr_error([],
+ ['push', '-d', 'from', self.get_url('to')])
+ self.assertRaises(errors.NotBranchError, bzrdir.BzrDir.open,
+ self.get_url('to'))
+
     def create_simple_tree(self):
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/a'])

=== modified file 'bzrlib/tests/per_branch/test_create_clone.py'
--- bzrlib/tests/per_branch/test_create_clone.py 2009-08-20 04:09:58 +0000
+++ bzrlib/tests/per_branch/test_create_clone.py 2009-08-27 00:21:06 +0000
@@ -16,15 +16,40 @@

 """Tests for branch.create_clone behaviour."""

+from bzrlib import (
+ bzrdir,
+ errors,
+ remote,
+ tests,
+ )
 from bzrlib.branch import Branch
-from bzrlib import errors
-from bzrlib import remote
-from bzrlib import tests
 from bzrlib.tests.per_branch.test_branch import TestCaseWithBranch

 class TestCreateClone(TestCaseWithBranch):

+ def test_create_clone_on_transport_autostack_incompatible(self):
+ # Test that when we push somewhere with an autostack policy pointing
+ # at an incompatible branch we give an error cleanly and don't create
+ # the target.
+ tree = self.make_branch_and_tree('source')
+ revid = tree.commit('a commit')
+ # Create an incompatible format - rich roots we try to stack on
+ # 1.9, and non rich roots (like 1.9) we try to stack on 2a.
+ if tree.branch.repository.supports_rich_root():
+ trunk_format = "1.9"
+ else:
+ trunk_format = "2a"
+ target_transport = self.get_transport('target')
+ trunk = self.make_branch_and_tree(target_transport.base,
+ format=trunk_format)
+ source = tree.branch
+ self.assertRaises(errors.IncompatibleRepositories,
+ source.create_clone_on_transport, target_transport,
+ stacked_on=trunk.base)
+ self.assertRaises(errors.NotBranchError,
+ bzrdir.BzrDir.open_from_transport, target_transport)
+
     def test_create_clone_on_transport_missing_parent_dir(self):
         tree = self.make_branch_and_tree('source')
         tree.commit('a commit')

Changed in bzr:
assignee: Robert Collins (lifeless) → nobody
Revision history for this message
Robert Collins (lifeless) wrote :

I was working on this, but we've dropped it from being a release blocker, so I'm switching to more important bug. I've included a diff of the current divide-and-conquer tests I had been writing.

description: updated
summary: - pushing a 1.9 branch stacked on a 2a branch causes problems
+ pushing a new 1.9 branch stacked on a 2a branch fails leaving an empty
+ branch behind.
Jelmer Vernooij (jelmer)
tags: added: formats hpss push
Revision history for this message
John A Meinel (jameinel) wrote :

Not actually in-progress anymore, and I'm dropping the priority because it isn't as common as it used to be.

Changed in bzr:
importance: High → Medium
status: In Progress → Confirmed
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.