Merge lp:~jelmer/brz/stacked-on-location into lp:brz/3.0

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/stacked-on-location
Merge into: lp:brz/3.0
Diff against target: 57 lines (+22/-0)
2 files modified
breezy/builtins.py (+2/-0)
breezy/tests/blackbox/test_push.py (+20/-0)
To merge this branch: bzr merge lp:~jelmer/brz/stacked-on-location
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+363693@code.launchpad.net

Commit message

Support directory references in stacked-on locations.

Description of the change

Support directory references in stacked-on locations.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/builtins.py'
--- breezy/builtins.py 2019-02-09 03:23:20 +0000
+++ breezy/builtins.py 2019-02-27 01:43:42 +0000
@@ -1344,6 +1344,7 @@
1344 use_existing_dir=False, directory=None, stacked_on=None,1344 use_existing_dir=False, directory=None, stacked_on=None,
1345 stacked=False, strict=None, no_tree=False,1345 stacked=False, strict=None, no_tree=False,
1346 overwrite_tags=False, lossy=False):1346 overwrite_tags=False, lossy=False):
1347 from .location import location_to_url
1347 from .push import _show_push_branch1348 from .push import _show_push_branch
13481349
1349 if overwrite:1350 if overwrite:
@@ -1371,6 +1372,7 @@
1371 more_warning='Uncommitted changes will not be pushed.')1372 more_warning='Uncommitted changes will not be pushed.')
1372 # Get the stacked_on branch, if any1373 # Get the stacked_on branch, if any
1373 if stacked_on is not None:1374 if stacked_on is not None:
1375 stacked_on = location_to_url(stacked_on, 'read')
1374 stacked_on = urlutils.normalize_url(stacked_on)1376 stacked_on = urlutils.normalize_url(stacked_on)
1375 elif stacked:1377 elif stacked:
1376 parent_url = br_from.get_parent()1378 parent_url = br_from.get_parent()
13771379
=== modified file 'breezy/tests/blackbox/test_push.py'
--- breezy/tests/blackbox/test_push.py 2018-11-16 12:08:41 +0000
+++ breezy/tests/blackbox/test_push.py 2019-02-27 01:43:42 +0000
@@ -22,6 +22,7 @@
22from breezy import (22from breezy import (
23 branch,23 branch,
24 controldir,24 controldir,
25 directory_service,
25 errors,26 errors,
26 osutils,27 osutils,
27 tests,28 tests,
@@ -498,6 +499,25 @@
498 self.assertPublished(branch_tree.last_revision(),499 self.assertPublished(branch_tree.last_revision(),
499 trunk_tree.branch.base)500 trunk_tree.branch.base)
500501
502 def test_push_new_branch_stacked_on(self):
503 """Pushing a new branch with --stacked-on can use directory URLs."""
504 trunk_tree, branch_tree = self.create_trunk_and_feature_branch()
505 class FooDirectory(object):
506 def look_up(self, name, url, purpose=None):
507 if url == 'foo:':
508 return trunk_tree.branch.base
509 return url
510 directory_service.directories.register('foo:', FooDirectory, 'Foo directory')
511 self.addCleanup(directory_service.directories.remove, 'foo:')
512 # we publish branch_tree with a reference to the mainline.
513 out, err = self.run_bzr(['push', '--stacked-on', 'foo:',
514 self.get_url('published')], working_dir='branch')
515 self.assertEqual('', out)
516 self.assertEqual('Created new stacked branch referring to %s.\n' %
517 trunk_tree.branch.base, err)
518 self.assertPublished(branch_tree.last_revision(),
519 trunk_tree.branch.base)
520
501 def test_push_new_branch_stacked_uses_parent_when_no_public_url(self):521 def test_push_new_branch_stacked_uses_parent_when_no_public_url(self):
502 """When the parent has no public url the parent is used as-is."""522 """When the parent has no public url the parent is used as-is."""
503 trunk_tree, branch_tree = self.create_trunk_and_feature_branch()523 trunk_tree, branch_tree = self.create_trunk_and_feature_branch()

Subscribers

People subscribed via source and target branches