Rev 4: Use the destination branch's submit location. in http://bazaar.launchpad.net/~jameinel/%2Bjunk/bzr-start
John Arbash Meinel
john at arbash-meinel.com
Wed Sep 9 18:27:51 BST 2009
At http://bazaar.launchpad.net/~jameinel/%2Bjunk/bzr-start
------------------------------------------------------------
revno: 4
revision-id: john at arbash-meinel.com-20090909172732-0eutvq0azso0rs8p
parent: john at arbash-meinel.com-20090121175350-vulro7idq2fhp07p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bzr-start
timestamp: Wed 2009-09-09 12:27:32 -0500
message:
Use the destination branch's submit location.
This allows me to have a config for all branches starting from the 'stable'
launchpad branch (bzr/2.0) versus all branches starting from 'bzr.dev'.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2009-01-21 17:53:50 +0000
+++ b/__init__.py 2009-09-09 17:27:32 +0000
@@ -46,7 +46,8 @@
workingtree,
)
wt, _ = workingtree.WorkingTree.open_containing('.')
- c = config.LocationConfig(wt.basedir)
+ path = osutils.normpath(osutils.pathjoin(wt.basedir, location))
+ c = config.LocationConfig(path)
submit_branch = c.get_user_option('submit_branch')
if submit_branch is None:
raise errors.BzrCommandError('No "submit_branch" configured')
=== modified file 'test_start.py'
--- a/test_start.py 2009-01-21 17:53:50 +0000
+++ b/test_start.py 2009-09-09 17:27:32 +0000
@@ -16,6 +16,8 @@
"""Tests for the 'start' plugin"""
+import os
+
from bzrlib import (
branch,
config,
@@ -37,6 +39,7 @@
c = config.LocationConfig(osutils.getcwd())
c.set_user_option('submit_branch', b.base)
b.create_checkout('tree', lightweight=True)
+ return b
def test_no_submit_branch(self):
self.run_bzr_error(['No "submit_branch" configured'],
@@ -64,3 +67,20 @@
tree = workingtree.WorkingTree.open('tree')
self.assertEqual(b.base, tree.branch.base)
self.assertEqual('rev1', tree.last_revision())
+
+ def test_submit_branch_from_target_location_not_tree(self):
+ # We should use the submit branch based on the branch we are creating
+ b = self.create_trunk_and_config()
+ os.mkdir('subset')
+ b2 = b.bzrdir.sprout('subset/trunk').open_branch()
+ # 'trunk' now has rev3, but 'subset/trunk' does not
+ t = workingtree.WorkingTree.open('tree')
+ t.commit('3', rev_id='rev3')
+ del t
+ c = config.LocationConfig(osutils.getcwd() + '/subset')
+ c.set_user_option('submit_branch', b2.base)
+ self.run_bzr('start ../subset/foobar', working_dir='tree')
+ b = branch.Branch.open('subset/foobar')
+ self.assertEqual('rev2', b.last_revision())
+ t = workingtree.WorkingTree.open('tree')
+ self.assertEqual('rev2', t.last_revision())
More information about the bazaar-commits
mailing list