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
1=== modified file 'breezy/builtins.py'
2--- breezy/builtins.py 2019-02-09 03:23:20 +0000
3+++ breezy/builtins.py 2019-02-27 01:43:42 +0000
4@@ -1344,6 +1344,7 @@
5 use_existing_dir=False, directory=None, stacked_on=None,
6 stacked=False, strict=None, no_tree=False,
7 overwrite_tags=False, lossy=False):
8+ from .location import location_to_url
9 from .push import _show_push_branch
10
11 if overwrite:
12@@ -1371,6 +1372,7 @@
13 more_warning='Uncommitted changes will not be pushed.')
14 # Get the stacked_on branch, if any
15 if stacked_on is not None:
16+ stacked_on = location_to_url(stacked_on, 'read')
17 stacked_on = urlutils.normalize_url(stacked_on)
18 elif stacked:
19 parent_url = br_from.get_parent()
20
21=== modified file 'breezy/tests/blackbox/test_push.py'
22--- breezy/tests/blackbox/test_push.py 2018-11-16 12:08:41 +0000
23+++ breezy/tests/blackbox/test_push.py 2019-02-27 01:43:42 +0000
24@@ -22,6 +22,7 @@
25 from breezy import (
26 branch,
27 controldir,
28+ directory_service,
29 errors,
30 osutils,
31 tests,
32@@ -498,6 +499,25 @@
33 self.assertPublished(branch_tree.last_revision(),
34 trunk_tree.branch.base)
35
36+ def test_push_new_branch_stacked_on(self):
37+ """Pushing a new branch with --stacked-on can use directory URLs."""
38+ trunk_tree, branch_tree = self.create_trunk_and_feature_branch()
39+ class FooDirectory(object):
40+ def look_up(self, name, url, purpose=None):
41+ if url == 'foo:':
42+ return trunk_tree.branch.base
43+ return url
44+ directory_service.directories.register('foo:', FooDirectory, 'Foo directory')
45+ self.addCleanup(directory_service.directories.remove, 'foo:')
46+ # we publish branch_tree with a reference to the mainline.
47+ out, err = self.run_bzr(['push', '--stacked-on', 'foo:',
48+ self.get_url('published')], working_dir='branch')
49+ self.assertEqual('', out)
50+ self.assertEqual('Created new stacked branch referring to %s.\n' %
51+ trunk_tree.branch.base, err)
52+ self.assertPublished(branch_tree.last_revision(),
53+ trunk_tree.branch.base)
54+
55 def test_push_new_branch_stacked_uses_parent_when_no_public_url(self):
56 """When the parent has no public url the parent is used as-is."""
57 trunk_tree, branch_tree = self.create_trunk_and_feature_branch()

Subscribers

People subscribed via source and target branches