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/clone | ||||
Merge into: | lp:brz/3.1 | ||||
Diff against target: |
948 lines (+305/-83) 20 files modified
breezy/branch.py (+3/-3) breezy/builtins.py (+33/-0) breezy/bzr/branch.py (+3/-3) breezy/bzr/bzrdir.py (+29/-14) breezy/bzr/remote.py (+23/-4) breezy/bzr/smart/bzrdir.py (+10/-3) breezy/controldir.py (+12/-0) breezy/git/dir.py (+25/-9) breezy/git/tests/test_blackbox.py (+3/-3) breezy/git/tests/test_remote.py (+2/-0) breezy/info.py (+1/-1) breezy/plugins/weave_fmt/bzrdir.py (+1/-1) breezy/tests/blackbox/__init__.py (+1/-0) breezy/tests/blackbox/test_clone.py (+70/-0) breezy/tests/blackbox/test_switch.py (+1/-1) breezy/tests/per_bzrdir/test_bzrdir.py (+1/-1) breezy/tests/per_controldir/test_controldir.py (+62/-40) breezy/tests/per_controldir_colo/test_supported.py (+5/-0) breezy/tests/test_smart.py (+13/-0) doc/en/release-notes/brz-3.1.txt (+7/-0) |
||||
To merge this branch: | bzr merge lp:~jelmer/brz/clone | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+379369@code.launchpad.net |
Commit message
Add a 'brz clone' command.
Description of the change
Add a 'brz clone' command.
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/branch.py' | |||
2 | --- breezy/branch.py 2020-02-18 03:11:01 +0000 | |||
3 | +++ breezy/branch.py 2020-03-22 21:30:11 +0000 | |||
4 | @@ -1194,8 +1194,8 @@ | |||
5 | 1194 | if revno < 1 or revno > self.revno(): | 1194 | if revno < 1 or revno > self.revno(): |
6 | 1195 | raise errors.InvalidRevisionNumber(revno) | 1195 | raise errors.InvalidRevisionNumber(revno) |
7 | 1196 | 1196 | ||
10 | 1197 | def clone(self, to_controldir, revision_id=None, repository_policy=None, | 1197 | def clone(self, to_controldir, revision_id=None, name=None, |
11 | 1198 | tag_selector=None): | 1198 | repository_policy=None, tag_selector=None): |
12 | 1199 | """Clone this branch into to_controldir preserving all semantic values. | 1199 | """Clone this branch into to_controldir preserving all semantic values. |
13 | 1200 | 1200 | ||
14 | 1201 | Most API users will want 'create_clone_on_transport', which creates a | 1201 | Most API users will want 'create_clone_on_transport', which creates a |
15 | @@ -1204,7 +1204,7 @@ | |||
16 | 1204 | revision_id: if not None, the revision history in the new branch will | 1204 | revision_id: if not None, the revision history in the new branch will |
17 | 1205 | be truncated to end with revision_id. | 1205 | be truncated to end with revision_id. |
18 | 1206 | """ | 1206 | """ |
20 | 1207 | result = to_controldir.create_branch() | 1207 | result = to_controldir.create_branch(name=name) |
21 | 1208 | with self.lock_read(), result.lock_write(): | 1208 | with self.lock_read(), result.lock_write(): |
22 | 1209 | if repository_policy is not None: | 1209 | if repository_policy is not None: |
23 | 1210 | repository_policy.configure_branch(result) | 1210 | repository_policy.configure_branch(result) |
24 | 1211 | 1211 | ||
25 | === modified file 'breezy/builtins.py' | |||
26 | --- breezy/builtins.py 2020-01-31 02:34:57 +0000 | |||
27 | +++ breezy/builtins.py 2020-03-22 21:30:11 +0000 | |||
28 | @@ -1442,6 +1442,7 @@ | |||
29 | 1442 | parameter, as in "branch foo/bar -r 5". | 1442 | parameter, as in "branch foo/bar -r 5". |
30 | 1443 | """ | 1443 | """ |
31 | 1444 | 1444 | ||
32 | 1445 | aliase = ['sprout'] | ||
33 | 1445 | _see_also = ['checkout'] | 1446 | _see_also = ['checkout'] |
34 | 1446 | takes_args = ['from_location', 'to_location?'] | 1447 | takes_args = ['from_location', 'to_location?'] |
35 | 1447 | takes_options = ['revision', | 1448 | takes_options = ['revision', |
36 | @@ -1704,6 +1705,38 @@ | |||
37 | 1704 | accelerator_tree, hardlink) | 1705 | accelerator_tree, hardlink) |
38 | 1705 | 1706 | ||
39 | 1706 | 1707 | ||
40 | 1708 | class cmd_clone(Command): | ||
41 | 1709 | __doc__ = """Clone a control directory. | ||
42 | 1710 | """ | ||
43 | 1711 | |||
44 | 1712 | takes_args = ['from_location', 'to_location?'] | ||
45 | 1713 | takes_options = ['revision', | ||
46 | 1714 | Option('no-recurse-nested', | ||
47 | 1715 | help='Do not recursively check out nested trees.'), | ||
48 | 1716 | ] | ||
49 | 1717 | |||
50 | 1718 | def run(self, from_location, to_location=None, revision=None, no_recurse_nested=False): | ||
51 | 1719 | accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch( | ||
52 | 1720 | from_location) | ||
53 | 1721 | if no_recurse_nested: | ||
54 | 1722 | recurse = 'none' | ||
55 | 1723 | else: | ||
56 | 1724 | recurse = 'down' | ||
57 | 1725 | revision = _get_one_revision('branch', revision) | ||
58 | 1726 | self.enter_context(br_from.lock_read()) | ||
59 | 1727 | if revision is not None: | ||
60 | 1728 | revision_id = revision.as_revision_id(br_from) | ||
61 | 1729 | else: | ||
62 | 1730 | # FIXME - wt.last_revision, fallback to branch, fall back to | ||
63 | 1731 | # None or perhaps NULL_REVISION to mean copy nothing | ||
64 | 1732 | # RBC 20060209 | ||
65 | 1733 | revision_id = br_from.last_revision() | ||
66 | 1734 | if to_location is None: | ||
67 | 1735 | to_location = urlutils.derive_to_location(from_location) | ||
68 | 1736 | target_controldir = br_from.controldir.clone(to_location, revision_id=revision_id) | ||
69 | 1737 | note(gettext('Created new control directory.')) | ||
70 | 1738 | |||
71 | 1739 | |||
72 | 1707 | class cmd_renames(Command): | 1740 | class cmd_renames(Command): |
73 | 1708 | __doc__ = """Show list of renamed files. | 1741 | __doc__ = """Show list of renamed files. |
74 | 1709 | """ | 1742 | """ |
75 | 1710 | 1743 | ||
76 | === modified file 'breezy/bzr/branch.py' | |||
77 | --- breezy/bzr/branch.py 2020-02-18 03:11:01 +0000 | |||
78 | +++ breezy/bzr/branch.py 2020-03-22 21:30:11 +0000 | |||
79 | @@ -1032,10 +1032,10 @@ | |||
80 | 1032 | 1032 | ||
81 | 1033 | def _make_reference_clone_function(format, a_branch): | 1033 | def _make_reference_clone_function(format, a_branch): |
82 | 1034 | """Create a clone() routine for a branch dynamically.""" | 1034 | """Create a clone() routine for a branch dynamically.""" |
85 | 1035 | def clone(to_bzrdir, revision_id=None, | 1035 | def clone(to_bzrdir, revision_id=None, repository_policy=None, name=None, |
86 | 1036 | repository_policy=None, tag_selector=None): | 1036 | tag_selector=None): |
87 | 1037 | """See Branch.clone().""" | 1037 | """See Branch.clone().""" |
89 | 1038 | return format.initialize(to_bzrdir, target_branch=a_branch) | 1038 | return format.initialize(to_bzrdir, target_branch=a_branch, name=name) |
90 | 1039 | # cannot obey revision_id limits when cloning a reference ... | 1039 | # cannot obey revision_id limits when cloning a reference ... |
91 | 1040 | # FIXME RBC 20060210 either nuke revision_id for clone, or | 1040 | # FIXME RBC 20060210 either nuke revision_id for clone, or |
92 | 1041 | # emit some sort of warning/error to the caller ?! | 1041 | # emit some sort of warning/error to the caller ?! |
93 | 1042 | 1042 | ||
94 | === modified file 'breezy/bzr/bzrdir.py' | |||
95 | --- breezy/bzr/bzrdir.py 2020-02-18 03:11:01 +0000 | |||
96 | +++ breezy/bzr/bzrdir.py 2020-03-22 21:30:11 +0000 | |||
97 | @@ -174,17 +174,18 @@ | |||
98 | 174 | local_repo = self.find_repository() | 174 | local_repo = self.find_repository() |
99 | 175 | except errors.NoRepositoryPresent: | 175 | except errors.NoRepositoryPresent: |
100 | 176 | local_repo = None | 176 | local_repo = None |
101 | 177 | local_branches = self.get_branches() | ||
102 | 177 | try: | 178 | try: |
106 | 178 | local_branch = self.open_branch() | 179 | local_active_branch = local_branches[''] |
107 | 179 | except errors.NotBranchError: | 180 | except KeyError: |
108 | 180 | local_branch = None | 181 | pass |
109 | 181 | else: | 182 | else: |
110 | 182 | # enable fallbacks when branch is not a branch reference | 183 | # enable fallbacks when branch is not a branch reference |
113 | 183 | if local_branch.repository.has_same_location(local_repo): | 184 | if local_active_branch.repository.has_same_location(local_repo): |
114 | 184 | local_repo = local_branch.repository | 185 | local_repo = local_active_branch.repository |
115 | 185 | if preserve_stacking: | 186 | if preserve_stacking: |
116 | 186 | try: | 187 | try: |
118 | 187 | stacked_on = local_branch.get_stacked_on_url() | 188 | stacked_on = local_active_branch.get_stacked_on_url() |
119 | 188 | except (_mod_branch.UnstackableBranchFormat, | 189 | except (_mod_branch.UnstackableBranchFormat, |
120 | 189 | errors.UnstackableRepositoryFormat, | 190 | errors.UnstackableRepositoryFormat, |
121 | 190 | errors.NotStacked): | 191 | errors.NotStacked): |
122 | @@ -233,11 +234,11 @@ | |||
123 | 233 | # 1 if there is a branch present | 234 | # 1 if there is a branch present |
124 | 234 | # make sure its content is available in the target repository | 235 | # make sure its content is available in the target repository |
125 | 235 | # clone it. | 236 | # clone it. |
127 | 236 | if local_branch is not None: | 237 | for name, local_branch in local_branches.items(): |
128 | 237 | local_branch.clone( | 238 | local_branch.clone( |
130 | 238 | result, revision_id=revision_id, | 239 | result, revision_id=(None if name != '' else revision_id), |
131 | 239 | repository_policy=repository_policy, | 240 | repository_policy=repository_policy, |
133 | 240 | tag_selector=tag_selector) | 241 | name=name, tag_selector=tag_selector) |
134 | 241 | try: | 242 | try: |
135 | 242 | # Cheaper to check if the target is not local, than to try making | 243 | # Cheaper to check if the target is not local, than to try making |
136 | 243 | # the tree and fail. | 244 | # the tree and fail. |
137 | @@ -1016,6 +1017,18 @@ | |||
138 | 1016 | pass | 1017 | pass |
139 | 1017 | return self.transport.clone('checkout') | 1018 | return self.transport.clone('checkout') |
140 | 1018 | 1019 | ||
141 | 1020 | def branch_names(self): | ||
142 | 1021 | """See ControlDir.branch_names.""" | ||
143 | 1022 | ret = [] | ||
144 | 1023 | try: | ||
145 | 1024 | self.get_branch_reference() | ||
146 | 1025 | except errors.NotBranchError: | ||
147 | 1026 | pass | ||
148 | 1027 | else: | ||
149 | 1028 | ret.append("") | ||
150 | 1029 | ret.extend(self._read_branch_list()) | ||
151 | 1030 | return ret | ||
152 | 1031 | |||
153 | 1019 | def get_branches(self): | 1032 | def get_branches(self): |
154 | 1020 | """See ControlDir.get_branches.""" | 1033 | """See ControlDir.get_branches.""" |
155 | 1021 | ret = {} | 1034 | ret = {} |
156 | @@ -1314,11 +1327,13 @@ | |||
157 | 1314 | remote_dir_format = RemoteBzrDirFormat() | 1327 | remote_dir_format = RemoteBzrDirFormat() |
158 | 1315 | remote_dir_format._network_name = self.network_name() | 1328 | remote_dir_format._network_name = self.network_name() |
159 | 1316 | self._supply_sub_formats_to(remote_dir_format) | 1329 | self._supply_sub_formats_to(remote_dir_format) |
165 | 1317 | return remote_dir_format.initialize_on_transport_ex(transport, | 1330 | return remote_dir_format.initialize_on_transport_ex( |
166 | 1318 | use_existing_dir=use_existing_dir, create_prefix=create_prefix, | 1331 | transport, use_existing_dir=use_existing_dir, |
167 | 1319 | force_new_repo=force_new_repo, stacked_on=stacked_on, | 1332 | create_prefix=create_prefix, force_new_repo=force_new_repo, |
168 | 1320 | stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name, | 1333 | stacked_on=stacked_on, stack_on_pwd=stack_on_pwd, |
169 | 1321 | make_working_trees=make_working_trees, shared_repo=shared_repo) | 1334 | repo_format_name=repo_format_name, |
170 | 1335 | make_working_trees=make_working_trees, | ||
171 | 1336 | shared_repo=shared_repo) | ||
172 | 1322 | # XXX: Refactor the create_prefix/no_create_prefix code into a | 1337 | # XXX: Refactor the create_prefix/no_create_prefix code into a |
173 | 1323 | # common helper function | 1338 | # common helper function |
174 | 1324 | # The destination may not exist - if so make it according to policy. | 1339 | # The destination may not exist - if so make it according to policy. |
175 | 1325 | 1340 | ||
176 | === modified file 'breezy/bzr/remote.py' | |||
177 | --- breezy/bzr/remote.py 2020-02-19 04:50:09 +0000 | |||
178 | +++ breezy/bzr/remote.py 2020-03-22 21:30:11 +0000 | |||
179 | @@ -707,6 +707,23 @@ | |||
180 | 707 | b = self.open_branch(name=name) | 707 | b = self.open_branch(name=name) |
181 | 708 | return b._format | 708 | return b._format |
182 | 709 | 709 | ||
183 | 710 | def branch_names(self): | ||
184 | 711 | path = self._path_for_remote_call(self._client) | ||
185 | 712 | try: | ||
186 | 713 | response, handler = self._call_expecting_body( | ||
187 | 714 | b'BzrDir.get_branches', path) | ||
188 | 715 | except errors.UnknownSmartMethod: | ||
189 | 716 | self._ensure_real() | ||
190 | 717 | return self._real_bzrdir.branch_names() | ||
191 | 718 | if response[0] != b"success": | ||
192 | 719 | raise errors.UnexpectedSmartServerResponse(response) | ||
193 | 720 | body = bencode.bdecode(handler.read_body_bytes()) | ||
194 | 721 | ret = [] | ||
195 | 722 | for name, value in viewitems(body): | ||
196 | 723 | name = name.decode('utf-8') | ||
197 | 724 | ret.append(name) | ||
198 | 725 | return ret | ||
199 | 726 | |||
200 | 710 | def get_branches(self, possible_transports=None, ignore_fallbacks=False): | 727 | def get_branches(self, possible_transports=None, ignore_fallbacks=False): |
201 | 711 | path = self._path_for_remote_call(self._client) | 728 | path = self._path_for_remote_call(self._client) |
202 | 712 | try: | 729 | try: |
203 | @@ -721,9 +738,10 @@ | |||
204 | 721 | ret = {} | 738 | ret = {} |
205 | 722 | for name, value in viewitems(body): | 739 | for name, value in viewitems(body): |
206 | 723 | name = name.decode('utf-8') | 740 | name = name.decode('utf-8') |
210 | 724 | ret[name] = self._open_branch(name, value[0], value[1], | 741 | ret[name] = self._open_branch( |
211 | 725 | possible_transports=possible_transports, | 742 | name, value[0].decode('ascii'), value[1], |
212 | 726 | ignore_fallbacks=ignore_fallbacks) | 743 | possible_transports=possible_transports, |
213 | 744 | ignore_fallbacks=ignore_fallbacks) | ||
214 | 727 | return ret | 745 | return ret |
215 | 728 | 746 | ||
216 | 729 | def set_branch_reference(self, target_branch, name=None): | 747 | def set_branch_reference(self, target_branch, name=None): |
217 | @@ -792,8 +810,9 @@ | |||
218 | 792 | if kind == 'ref': | 810 | if kind == 'ref': |
219 | 793 | # a branch reference, use the existing BranchReference logic. | 811 | # a branch reference, use the existing BranchReference logic. |
220 | 794 | format = BranchReferenceFormat() | 812 | format = BranchReferenceFormat() |
221 | 813 | ref_loc = urlutils.join(self.user_url, location_or_format.decode('utf-8')) | ||
222 | 795 | return format.open(self, name=name, _found=True, | 814 | return format.open(self, name=name, _found=True, |
224 | 796 | location=location_or_format.decode('utf-8'), | 815 | location=ref_loc, |
225 | 797 | ignore_fallbacks=ignore_fallbacks, | 816 | ignore_fallbacks=ignore_fallbacks, |
226 | 798 | possible_transports=possible_transports) | 817 | possible_transports=possible_transports) |
227 | 799 | branch_format_name = location_or_format | 818 | branch_format_name = location_or_format |
228 | 800 | 819 | ||
229 | === modified file 'breezy/bzr/smart/bzrdir.py' | |||
230 | --- breezy/bzr/smart/bzrdir.py 2018-11-11 04:08:32 +0000 | |||
231 | +++ breezy/bzr/smart/bzrdir.py 2020-03-22 21:30:11 +0000 | |||
232 | @@ -443,12 +443,19 @@ | |||
233 | 443 | The body is a bencoded dictionary, with values similar to the return | 443 | The body is a bencoded dictionary, with values similar to the return |
234 | 444 | value of the open branch request. | 444 | value of the open branch request. |
235 | 445 | """ | 445 | """ |
237 | 446 | branches = self._bzrdir.get_branches() | 446 | branch_names = self._bzrdir.branch_names() |
238 | 447 | ret = {} | 447 | ret = {} |
240 | 448 | for name, b in branches.items(): | 448 | for name in branch_names: |
241 | 449 | if name is None: | 449 | if name is None: |
242 | 450 | name = b"" | 450 | name = b"" |
244 | 451 | ret[name.encode('utf-8')] = (b"branch", b._format.network_name()) | 451 | branch_ref = self._bzrdir.get_branch_reference(name=name) |
245 | 452 | if branch_ref is not None: | ||
246 | 453 | branch_ref = urlutils.relative_url(self._bzrdir.user_url, branch_ref) | ||
247 | 454 | value = (b"ref", branch_ref.encode('utf-8')) | ||
248 | 455 | else: | ||
249 | 456 | b = self._bzrdir.open_branch(name=name, ignore_fallbacks=True) | ||
250 | 457 | value = (b"branch", b._format.network_name()) | ||
251 | 458 | ret[name.encode('utf-8')] = value | ||
252 | 452 | return SuccessfulSmartServerResponse( | 459 | return SuccessfulSmartServerResponse( |
253 | 453 | (b"success", ), bencode.bencode(ret)) | 460 | (b"success", ), bencode.bencode(ret)) |
254 | 454 | 461 | ||
255 | 455 | 462 | ||
256 | === modified file 'breezy/controldir.py' | |||
257 | --- breezy/controldir.py 2020-02-18 03:11:01 +0000 | |||
258 | +++ breezy/controldir.py 2020-03-22 21:30:11 +0000 | |||
259 | @@ -129,6 +129,18 @@ | |||
260 | 129 | """ | 129 | """ |
261 | 130 | return list(self.get_branches().values()) | 130 | return list(self.get_branches().values()) |
262 | 131 | 131 | ||
263 | 132 | def branch_names(self): | ||
264 | 133 | """List all branch names in this control directory. | ||
265 | 134 | |||
266 | 135 | :return: List of branch names | ||
267 | 136 | """ | ||
268 | 137 | try: | ||
269 | 138 | self.get_branch_reference() | ||
270 | 139 | except (errors.NotBranchError, errors.NoRepositoryPresent): | ||
271 | 140 | return [] | ||
272 | 141 | else: | ||
273 | 142 | return [""] | ||
274 | 143 | |||
275 | 132 | def get_branches(self): | 144 | def get_branches(self): |
276 | 133 | """Get all branches in this control directory, as a dictionary. | 145 | """Get all branches in this control directory, as a dictionary. |
277 | 134 | 146 | ||
278 | 135 | 147 | ||
279 | === modified file 'breezy/git/dir.py' | |||
280 | --- breezy/git/dir.py 2020-02-19 04:50:09 +0000 | |||
281 | +++ breezy/git/dir.py 2020-03-22 21:30:11 +0000 | |||
282 | @@ -228,6 +228,7 @@ | |||
283 | 228 | """See ControlDir.clone_on_transport.""" | 228 | """See ControlDir.clone_on_transport.""" |
284 | 229 | from ..repository import InterRepository | 229 | from ..repository import InterRepository |
285 | 230 | from .mapping import default_mapping | 230 | from .mapping import default_mapping |
286 | 231 | from ..transport.local import LocalTransport | ||
287 | 231 | if stacked_on is not None: | 232 | if stacked_on is not None: |
288 | 232 | raise _mod_branch.UnstackableBranchFormat( | 233 | raise _mod_branch.UnstackableBranchFormat( |
289 | 233 | self._format, self.user_url) | 234 | self._format, self.user_url) |
290 | @@ -253,18 +254,19 @@ | |||
291 | 253 | mapping=default_mapping) | 254 | mapping=default_mapping) |
292 | 254 | for name, val in viewitems(refs): | 255 | for name, val in viewitems(refs): |
293 | 255 | target_git_repo.refs[name] = val | 256 | target_git_repo.refs[name] = val |
295 | 256 | result_dir = self.__class__(transport, target_git_repo, format) | 257 | result_dir = LocalGitDir(transport, target_git_repo, format) |
296 | 257 | if revision_id is not None: | 258 | if revision_id is not None: |
297 | 258 | result_dir.open_branch().set_last_revision(revision_id) | 259 | result_dir.open_branch().set_last_revision(revision_id) |
302 | 259 | try: | 260 | if not no_tree and isinstance(result_dir.root_transport, LocalTransport): |
299 | 260 | # Cheaper to check if the target is not local, than to try making | ||
300 | 261 | # the tree and fail. | ||
301 | 262 | result_dir.root_transport.local_abspath('.') | ||
303 | 263 | if result_dir.open_repository().make_working_trees(): | 261 | if result_dir.open_repository().make_working_trees(): |
308 | 264 | self.open_workingtree().clone( | 262 | try: |
309 | 265 | result_dir, revision_id=revision_id) | 263 | local_wt = self.open_workingtree() |
310 | 266 | except (brz_errors.NoWorkingTree, brz_errors.NotLocalUrl): | 264 | except brz_errors.NoWorkingTree: |
311 | 267 | pass | 265 | pass |
312 | 266 | except brz_errors.NotLocalUrl: | ||
313 | 267 | result_dir.create_workingtree(revision_id=revision_id) | ||
314 | 268 | else: | ||
315 | 269 | local_wt.clone(result_dir, revision_id=revision_id) | ||
316 | 268 | 270 | ||
317 | 269 | return result_dir | 271 | return result_dir |
318 | 270 | 272 | ||
319 | @@ -299,6 +301,20 @@ | |||
320 | 299 | """ | 301 | """ |
321 | 300 | return UseExistingRepository(self.find_repository()) | 302 | return UseExistingRepository(self.find_repository()) |
322 | 301 | 303 | ||
323 | 304 | def branch_names(self): | ||
324 | 305 | from .refs import ref_to_branch_name | ||
325 | 306 | ret = [] | ||
326 | 307 | for ref in self.get_refs_container().keys(): | ||
327 | 308 | try: | ||
328 | 309 | branch_name = ref_to_branch_name(ref) | ||
329 | 310 | except UnicodeDecodeError: | ||
330 | 311 | trace.warning("Ignoring branch %r with unicode error ref", ref) | ||
331 | 312 | continue | ||
332 | 313 | except ValueError: | ||
333 | 314 | continue | ||
334 | 315 | ret.append(branch_name) | ||
335 | 316 | return ret | ||
336 | 317 | |||
337 | 302 | def get_branches(self): | 318 | def get_branches(self): |
338 | 303 | from .refs import ref_to_branch_name | 319 | from .refs import ref_to_branch_name |
339 | 304 | ret = {} | 320 | ret = {} |
340 | 305 | 321 | ||
341 | === modified file 'breezy/git/tests/test_blackbox.py' | |||
342 | --- breezy/git/tests/test_blackbox.py 2020-03-21 20:56:33 +0000 | |||
343 | +++ breezy/git/tests/test_blackbox.py 2020-03-22 21:30:11 +0000 | |||
344 | @@ -349,7 +349,7 @@ | |||
345 | 349 | self.run_bzr(["git-import", "--colocated", "a", "b"]) | 349 | self.run_bzr(["git-import", "--colocated", "a", "b"]) |
346 | 350 | self.assertEqual(set([".bzr"]), set(os.listdir("b"))) | 350 | self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
347 | 351 | self.assertEqual(set(["abranch", "bbranch"]), | 351 | self.assertEqual(set(["abranch", "bbranch"]), |
349 | 352 | set(ControlDir.open("b").get_branches().keys())) | 352 | set(ControlDir.open("b").branch_names())) |
350 | 353 | 353 | ||
351 | 354 | def test_git_import_incremental(self): | 354 | def test_git_import_incremental(self): |
352 | 355 | r = GitRepo.init("a", mkdir=True) | 355 | r = GitRepo.init("a", mkdir=True) |
353 | @@ -361,7 +361,7 @@ | |||
354 | 361 | self.run_bzr(["git-import", "--colocated", "a", "b"]) | 361 | self.run_bzr(["git-import", "--colocated", "a", "b"]) |
355 | 362 | self.assertEqual(set([".bzr"]), set(os.listdir("b"))) | 362 | self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
356 | 363 | b = ControlDir.open("b") | 363 | b = ControlDir.open("b") |
358 | 364 | self.assertEqual(["abranch"], list(b.get_branches().keys())) | 364 | self.assertEqual(["abranch"], b.branch_names()) |
359 | 365 | 365 | ||
360 | 366 | def test_git_import_tags(self): | 366 | def test_git_import_tags(self): |
361 | 367 | r = GitRepo.init("a", mkdir=True) | 367 | r = GitRepo.init("a", mkdir=True) |
362 | @@ -373,7 +373,7 @@ | |||
363 | 373 | self.run_bzr(["git-import", "--colocated", "a", "b"]) | 373 | self.run_bzr(["git-import", "--colocated", "a", "b"]) |
364 | 374 | self.assertEqual(set([".bzr"]), set(os.listdir("b"))) | 374 | self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
365 | 375 | b = ControlDir.open("b") | 375 | b = ControlDir.open("b") |
367 | 376 | self.assertEqual(["abranch"], list(b.get_branches().keys())) | 376 | self.assertEqual(["abranch"], b.branch_names()) |
368 | 377 | self.assertEqual(["atag"], | 377 | self.assertEqual(["atag"], |
369 | 378 | list(b.open_branch("abranch").tags.get_tag_dict().keys())) | 378 | list(b.open_branch("abranch").tags.get_tag_dict().keys())) |
370 | 379 | 379 | ||
371 | 380 | 380 | ||
372 | === modified file 'breezy/git/tests/test_remote.py' | |||
373 | --- breezy/git/tests/test_remote.py 2020-02-08 18:51:59 +0000 | |||
374 | +++ breezy/git/tests/test_remote.py 2020-03-22 21:30:11 +0000 | |||
375 | @@ -567,6 +567,8 @@ | |||
376 | 567 | self.assertEqual( | 567 | self.assertEqual( |
377 | 568 | {'': 'master', 'blah': 'blah', 'master': 'master'}, | 568 | {'': 'master', 'blah': 'blah', 'master': 'master'}, |
378 | 569 | {n: b.name for (n, b) in remote.get_branches().items()}) | 569 | {n: b.name for (n, b) in remote.get_branches().items()}) |
379 | 570 | self.assertEqual( | ||
380 | 571 | set(['', 'blah', 'master']), set(remote.branch_names())) | ||
381 | 570 | 572 | ||
382 | 571 | def test_remove_tag(self): | 573 | def test_remove_tag(self): |
383 | 572 | c1 = self.remote_real.do_commit( | 574 | c1 = self.remote_real.do_commit( |
384 | 573 | 575 | ||
385 | === modified file 'breezy/info.py' | |||
386 | --- breezy/info.py 2019-11-19 18:10:28 +0000 | |||
387 | +++ breezy/info.py 2020-03-22 21:30:11 +0000 | |||
388 | @@ -457,7 +457,7 @@ | |||
389 | 457 | extra = [] | 457 | extra = [] |
390 | 458 | if repository.make_working_trees(): | 458 | if repository.make_working_trees(): |
391 | 459 | extra.append('trees') | 459 | extra.append('trees') |
393 | 460 | if len(control.get_branches()) > 0: | 460 | if len(control.branch_names()) > 0: |
394 | 461 | extra.append('colocated branches') | 461 | extra.append('colocated branches') |
395 | 462 | if extra: | 462 | if extra: |
396 | 463 | phrase += ' with ' + " and ".join(extra) | 463 | phrase += ' with ' + " and ".join(extra) |
397 | 464 | 464 | ||
398 | === modified file 'breezy/plugins/weave_fmt/bzrdir.py' | |||
399 | --- breezy/plugins/weave_fmt/bzrdir.py 2020-02-18 03:16:21 +0000 | |||
400 | +++ breezy/plugins/weave_fmt/bzrdir.py 2020-03-22 21:30:11 +0000 | |||
401 | @@ -842,7 +842,7 @@ | |||
402 | 842 | 842 | ||
403 | 843 | def get_branch_transport(self, branch_format, name=None): | 843 | def get_branch_transport(self, branch_format, name=None): |
404 | 844 | """See BzrDir.get_branch_transport().""" | 844 | """See BzrDir.get_branch_transport().""" |
406 | 845 | if name is not None: | 845 | if name: |
407 | 846 | raise errors.NoColocatedBranchSupport(self) | 846 | raise errors.NoColocatedBranchSupport(self) |
408 | 847 | if branch_format is None: | 847 | if branch_format is None: |
409 | 848 | return self.transport | 848 | return self.transport |
410 | 849 | 849 | ||
411 | === modified file 'breezy/tests/blackbox/__init__.py' | |||
412 | --- breezy/tests/blackbox/__init__.py 2019-06-15 17:06:40 +0000 | |||
413 | +++ breezy/tests/blackbox/__init__.py 2020-03-22 21:30:11 +0000 | |||
414 | @@ -51,6 +51,7 @@ | |||
415 | 51 | 'test_check', | 51 | 'test_check', |
416 | 52 | 'test_checkout', | 52 | 'test_checkout', |
417 | 53 | 'test_clean_tree', | 53 | 'test_clean_tree', |
418 | 54 | 'test_clone', | ||
419 | 54 | 'test_command_encoding', | 55 | 'test_command_encoding', |
420 | 55 | 'test_commit', | 56 | 'test_commit', |
421 | 56 | 'test_config', | 57 | 'test_config', |
422 | 57 | 58 | ||
423 | === added file 'breezy/tests/blackbox/test_clone.py' | |||
424 | --- breezy/tests/blackbox/test_clone.py 1970-01-01 00:00:00 +0000 | |||
425 | +++ breezy/tests/blackbox/test_clone.py 2020-03-22 21:30:11 +0000 | |||
426 | @@ -0,0 +1,70 @@ | |||
427 | 1 | # Copyright (C) 2006-2012, 2016 Canonical Ltd | ||
428 | 2 | # | ||
429 | 3 | # This program is free software; you can redistribute it and/or modify | ||
430 | 4 | # it under the terms of the GNU General Public License as published by | ||
431 | 5 | # the Free Software Foundation; either version 2 of the License, or | ||
432 | 6 | # (at your option) any later version. | ||
433 | 7 | # | ||
434 | 8 | # This program is distributed in the hope that it will be useful, | ||
435 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
436 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
437 | 11 | # GNU General Public License for more details. | ||
438 | 12 | # | ||
439 | 13 | # You should have received a copy of the GNU General Public License | ||
440 | 14 | # along with this program; if not, write to the Free Software | ||
441 | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
442 | 16 | |||
443 | 17 | |||
444 | 18 | """Black-box tests for brz branch.""" | ||
445 | 19 | |||
446 | 20 | import os | ||
447 | 21 | |||
448 | 22 | from breezy import ( | ||
449 | 23 | branch, | ||
450 | 24 | controldir, | ||
451 | 25 | tests, | ||
452 | 26 | ) | ||
453 | 27 | from breezy.urlutils import local_path_to_url | ||
454 | 28 | |||
455 | 29 | |||
456 | 30 | class TestClone(tests.TestCaseWithTransport): | ||
457 | 31 | |||
458 | 32 | def example_dir(self, path='.', format=None): | ||
459 | 33 | tree = self.make_branch_and_tree(path, format=format) | ||
460 | 34 | self.build_tree_contents([(path + '/hello', b'foo')]) | ||
461 | 35 | tree.add('hello') | ||
462 | 36 | tree.commit(message='setup') | ||
463 | 37 | self.build_tree_contents([(path + '/goodbye', b'baz')]) | ||
464 | 38 | tree.add('goodbye') | ||
465 | 39 | tree.commit(message='setup') | ||
466 | 40 | return tree | ||
467 | 41 | |||
468 | 42 | def test_clone(self): | ||
469 | 43 | """Branch from one branch to another.""" | ||
470 | 44 | self.example_dir('a') | ||
471 | 45 | self.run_bzr('clone a b') | ||
472 | 46 | b = branch.Branch.open('b') | ||
473 | 47 | self.run_bzr('clone a c -r 1') | ||
474 | 48 | # previously was erroneously created by branching | ||
475 | 49 | self.assertFalse(b._transport.has('branch-name')) | ||
476 | 50 | b.controldir.open_workingtree().commit(message='foo', allow_pointless=True) | ||
477 | 51 | |||
478 | 52 | def test_clone_no_to_location(self): | ||
479 | 53 | """The to_location is derived from the source branch name.""" | ||
480 | 54 | os.mkdir("something") | ||
481 | 55 | a = self.example_dir('something/a').branch | ||
482 | 56 | self.run_bzr('clone something/a') | ||
483 | 57 | b = branch.Branch.open('a') | ||
484 | 58 | self.assertEqual(b.last_revision_info(), a.last_revision_info()) | ||
485 | 59 | |||
486 | 60 | def test_from_colocated(self): | ||
487 | 61 | """Branch from a colocated branch into a regular branch.""" | ||
488 | 62 | os.mkdir('b') | ||
489 | 63 | tree = self.example_dir('b/a') | ||
490 | 64 | tree.controldir.create_branch(name='somecolo') | ||
491 | 65 | out, err = self.run_bzr('clone %s' % local_path_to_url('b/a')) | ||
492 | 66 | self.assertEqual('', out) | ||
493 | 67 | self.assertEqual('Created new control directory.\n', err) | ||
494 | 68 | self.assertPathExists('a') | ||
495 | 69 | target = controldir.ControlDir.open('a') | ||
496 | 70 | self.assertEqual(['', 'somecolo'], target.branch_names()) | ||
497 | 0 | 71 | ||
498 | === modified file 'breezy/tests/blackbox/test_switch.py' | |||
499 | --- breezy/tests/blackbox/test_switch.py 2019-09-01 15:33:59 +0000 | |||
500 | +++ breezy/tests/blackbox/test_switch.py 2020-03-22 21:30:11 +0000 | |||
501 | @@ -207,7 +207,7 @@ | |||
502 | 207 | self.run_bzr(['switch', '-b', 'anotherbranch']) | 207 | self.run_bzr(['switch', '-b', 'anotherbranch']) |
503 | 208 | self.assertEqual( | 208 | self.assertEqual( |
504 | 209 | {'', 'anotherbranch'}, | 209 | {'', 'anotherbranch'}, |
506 | 210 | set(tree.branch.controldir.get_branches().keys())) | 210 | set(tree.branch.controldir.branch_names())) |
507 | 211 | 211 | ||
508 | 212 | def test_switch_into_unrelated_colocated(self): | 212 | def test_switch_into_unrelated_colocated(self): |
509 | 213 | # Create a new colocated branch from an existing non-colocated branch. | 213 | # Create a new colocated branch from an existing non-colocated branch. |
510 | 214 | 214 | ||
511 | === modified file 'breezy/tests/per_bzrdir/test_bzrdir.py' | |||
512 | --- breezy/tests/per_bzrdir/test_bzrdir.py 2018-11-11 04:08:32 +0000 | |||
513 | +++ breezy/tests/per_bzrdir/test_bzrdir.py 2020-03-22 21:30:11 +0000 | |||
514 | @@ -688,4 +688,4 @@ | |||
515 | 688 | target_branch = repo.controldir.create_branch(name='foo') | 688 | target_branch = repo.controldir.create_branch(name='foo') |
516 | 689 | repo.controldir.set_branch_reference(target_branch) | 689 | repo.controldir.set_branch_reference(target_branch) |
517 | 690 | self.assertEqual({"", 'foo'}, | 690 | self.assertEqual({"", 'foo'}, |
519 | 691 | set(repo.controldir.get_branches().keys())) | 691 | set(repo.controldir.branch_names())) |
520 | 692 | 692 | ||
521 | === modified file 'breezy/tests/per_controldir/test_controldir.py' | |||
522 | --- breezy/tests/per_controldir/test_controldir.py 2019-05-29 03:22:34 +0000 | |||
523 | +++ breezy/tests/per_controldir/test_controldir.py 2020-03-22 21:30:11 +0000 | |||
524 | @@ -199,7 +199,7 @@ | |||
525 | 199 | "control directories without working tree") | 199 | "control directories without working tree") |
526 | 200 | self.assertRaises(errors.NoWorkingTree, dir.open_workingtree) | 200 | self.assertRaises(errors.NoWorkingTree, dir.open_workingtree) |
527 | 201 | 201 | ||
529 | 202 | def test_clone_bzrdir_repository_under_shared(self): | 202 | def test_clone_controldir_repository_under_shared(self): |
530 | 203 | tree = self.make_branch_and_tree('commit_tree') | 203 | tree = self.make_branch_and_tree('commit_tree') |
531 | 204 | self.build_tree( | 204 | self.build_tree( |
532 | 205 | ['foo'], transport=tree.controldir.transport.clone('..')) | 205 | ['foo'], transport=tree.controldir.transport.clone('..')) |
533 | @@ -221,7 +221,7 @@ | |||
534 | 221 | self.assertNotEqual(dir.transport.base, target.transport.base) | 221 | self.assertNotEqual(dir.transport.base, target.transport.base) |
535 | 222 | self.assertRaises(errors.NoRepositoryPresent, target.open_repository) | 222 | self.assertRaises(errors.NoRepositoryPresent, target.open_repository) |
536 | 223 | 223 | ||
538 | 224 | def test_clone_bzrdir_repository_branch_both_under_shared(self): | 224 | def test_clone_controldir_repository_branch_both_under_shared(self): |
539 | 225 | # Create a shared repository | 225 | # Create a shared repository |
540 | 226 | try: | 226 | try: |
541 | 227 | shared_repo = self.make_repository('shared', shared=True) | 227 | shared_repo = self.make_repository('shared', shared=True) |
542 | @@ -249,7 +249,7 @@ | |||
543 | 249 | dir.create_branch() | 249 | dir.create_branch() |
544 | 250 | # Clone 'source' to 'target', also inside the shared repository. | 250 | # Clone 'source' to 'target', also inside the shared repository. |
545 | 251 | target = dir.clone(self.get_url('shared/target')) | 251 | target = dir.clone(self.get_url('shared/target')) |
547 | 252 | # 'source', 'target', and the shared repo all have distinct bzrdirs. | 252 | # 'source', 'target', and the shared repo all have distinct controldirs. |
548 | 253 | self.assertNotEqual(dir.transport.base, target.transport.base) | 253 | self.assertNotEqual(dir.transport.base, target.transport.base) |
549 | 254 | self.assertNotEqual( | 254 | self.assertNotEqual( |
550 | 255 | dir.transport.base, shared_repo.controldir.transport.base) | 255 | dir.transport.base, shared_repo.controldir.transport.base) |
551 | @@ -258,7 +258,7 @@ | |||
552 | 258 | # 'commit_tree' branch. | 258 | # 'commit_tree' branch. |
553 | 259 | self.assertTrue(shared_repo.has_revision(rev1)) | 259 | self.assertTrue(shared_repo.has_revision(rev1)) |
554 | 260 | 260 | ||
556 | 261 | def test_clone_bzrdir_repository_branch_only_source_under_shared(self): | 261 | def test_clone_controldir_repository_branch_only_source_under_shared(self): |
557 | 262 | try: | 262 | try: |
558 | 263 | shared_repo = self.make_repository('shared', shared=True) | 263 | shared_repo = self.make_repository('shared', shared=True) |
559 | 264 | except errors.IncompatibleFormat: | 264 | except errors.IncompatibleFormat: |
560 | @@ -291,7 +291,7 @@ | |||
561 | 291 | self.assertFalse(branch.repository.make_working_trees()) | 291 | self.assertFalse(branch.repository.make_working_trees()) |
562 | 292 | self.assertTrue(branch.repository.is_shared()) | 292 | self.assertTrue(branch.repository.is_shared()) |
563 | 293 | 293 | ||
565 | 294 | def test_clone_bzrdir_repository_revision(self): | 294 | def test_clone_controldir_repository_revision(self): |
566 | 295 | # test for revision limiting, [smoke test, not corner case checks]. | 295 | # test for revision limiting, [smoke test, not corner case checks]. |
567 | 296 | # make a repository with some revisions, | 296 | # make a repository with some revisions, |
568 | 297 | # and clone it with a revision limit. | 297 | # and clone it with a revision limit. |
569 | @@ -310,7 +310,7 @@ | |||
570 | 310 | dir.clone(self.get_url('target'), revision_id=rev2) | 310 | dir.clone(self.get_url('target'), revision_id=rev2) |
571 | 311 | raise TestSkipped('revision limiting not strict yet') | 311 | raise TestSkipped('revision limiting not strict yet') |
572 | 312 | 312 | ||
574 | 313 | def test_clone_bzrdir_branch_and_repo_fixed_user_id(self): | 313 | def test_clone_controldir_branch_and_repo_fixed_user_id(self): |
575 | 314 | # Bug #430868 is about an email containing '.sig' | 314 | # Bug #430868 is about an email containing '.sig' |
576 | 315 | self.overrideEnv('BRZ_EMAIL', 'murphy@host.sighup.org') | 315 | self.overrideEnv('BRZ_EMAIL', 'murphy@host.sighup.org') |
577 | 316 | tree = self.make_branch_and_tree('commit_tree') | 316 | tree = self.make_branch_and_tree('commit_tree') |
578 | @@ -330,7 +330,7 @@ | |||
579 | 330 | tree_repo.get_signature_text(rev1), | 330 | tree_repo.get_signature_text(rev1), |
580 | 331 | target.repository.get_signature_text(rev1)) | 331 | target.repository.get_signature_text(rev1)) |
581 | 332 | 332 | ||
583 | 333 | def test_clone_bzrdir_branch_and_repo_into_shared_repo(self): | 333 | def test_clone_controldir_branch_and_repo_into_shared_repo(self): |
584 | 334 | # by default cloning into a shared repo uses the shared repo. | 334 | # by default cloning into a shared repo uses the shared repo. |
585 | 335 | tree = self.make_branch_and_tree('commit_tree') | 335 | tree = self.make_branch_and_tree('commit_tree') |
586 | 336 | self.build_tree(['commit_tree/foo']) | 336 | self.build_tree(['commit_tree/foo']) |
587 | @@ -354,7 +354,7 @@ | |||
588 | 354 | self.assertEqual(source.last_revision(), | 354 | self.assertEqual(source.last_revision(), |
589 | 355 | target.open_branch().last_revision()) | 355 | target.open_branch().last_revision()) |
590 | 356 | 356 | ||
592 | 357 | def test_clone_bzrdir_branch_revision(self): | 357 | def test_clone_controldir_branch_revision(self): |
593 | 358 | # test for revision limiting, [smoke test, not corner case checks]. | 358 | # test for revision limiting, [smoke test, not corner case checks]. |
594 | 359 | # make a branch with some revisions, | 359 | # make a branch with some revisions, |
595 | 360 | # and clone it with a revision limit. | 360 | # and clone it with a revision limit. |
596 | @@ -371,6 +371,23 @@ | |||
597 | 371 | target = dir.clone(self.get_url('target'), revision_id=rev1) | 371 | target = dir.clone(self.get_url('target'), revision_id=rev1) |
598 | 372 | self.assertEqual(rev1, target.open_branch().last_revision()) | 372 | self.assertEqual(rev1, target.open_branch().last_revision()) |
599 | 373 | 373 | ||
600 | 374 | def test_clone_controldir_with_colocated(self): | ||
601 | 375 | if not self.bzrdir_format.colocated_branches: | ||
602 | 376 | raise TestNotApplicable( | ||
603 | 377 | 'format does not supported colocated branches') | ||
604 | 378 | tree = self.make_branch_and_tree('commit_tree') | ||
605 | 379 | self.build_tree(['commit_tree/foo']) | ||
606 | 380 | tree.add('foo') | ||
607 | 381 | rev1 = tree.commit('revision 1') | ||
608 | 382 | rev2 = tree.commit('revision 2', allow_pointless=True) | ||
609 | 383 | rev3 = tree.commit('revision 2', allow_pointless=True) | ||
610 | 384 | dir = tree.branch.controldir | ||
611 | 385 | colo = dir.create_branch(name='colo') | ||
612 | 386 | colo.pull(tree.branch, stop_revision=rev1) | ||
613 | 387 | target = dir.clone(self.get_url('target'), revision_id=rev2) | ||
614 | 388 | self.assertEqual(rev2, target.open_branch().last_revision()) | ||
615 | 389 | self.assertEqual(rev1, target.open_branch(name='colo').last_revision()) | ||
616 | 390 | |||
617 | 374 | def test_clone_on_transport_preserves_repo_format(self): | 391 | def test_clone_on_transport_preserves_repo_format(self): |
618 | 375 | if self.bzrdir_format == controldir.format_registry.make_controldir('default'): | 392 | if self.bzrdir_format == controldir.format_registry.make_controldir('default'): |
619 | 376 | format = 'knit' | 393 | format = 'knit' |
620 | @@ -381,8 +398,8 @@ | |||
621 | 381 | a_dir = breezy.branch.Branch.open_from_transport( | 398 | a_dir = breezy.branch.Branch.open_from_transport( |
622 | 382 | self.get_transport('source')).controldir | 399 | self.get_transport('source')).controldir |
623 | 383 | target_transport = self.get_transport('target') | 400 | target_transport = self.get_transport('target') |
626 | 384 | target_bzrdir = a_dir.clone_on_transport(target_transport) | 401 | target_controldir = a_dir.clone_on_transport(target_transport) |
627 | 385 | target_repo = target_bzrdir.open_repository() | 402 | target_repo = target_controldir.open_repository() |
628 | 386 | source_branch = breezy.branch.Branch.open( | 403 | source_branch = breezy.branch.Branch.open( |
629 | 387 | self.get_vfs_only_url('source')) | 404 | self.get_vfs_only_url('source')) |
630 | 388 | if isinstance(target_repo, RemoteRepository): | 405 | if isinstance(target_repo, RemoteRepository): |
631 | @@ -390,7 +407,7 @@ | |||
632 | 390 | target_repo = target_repo._real_repository | 407 | target_repo = target_repo._real_repository |
633 | 391 | self.assertEqual(target_repo._format, source_branch.repository._format) | 408 | self.assertEqual(target_repo._format, source_branch.repository._format) |
634 | 392 | 409 | ||
636 | 393 | def test_clone_bzrdir_tree_revision(self): | 410 | def test_clone_controldir_tree_revision(self): |
637 | 394 | # test for revision limiting, [smoke test, not corner case checks]. | 411 | # test for revision limiting, [smoke test, not corner case checks]. |
638 | 395 | # make a tree with a revision with a last-revision | 412 | # make a tree with a revision with a last-revision |
639 | 396 | # and clone it with a revision limit. | 413 | # and clone it with a revision limit. |
640 | @@ -406,7 +423,7 @@ | |||
641 | 406 | self.skipIfNoWorkingTree(target) | 423 | self.skipIfNoWorkingTree(target) |
642 | 407 | self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) | 424 | self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) |
643 | 408 | 425 | ||
645 | 409 | def test_clone_bzrdir_into_notrees_repo(self): | 426 | def test_clone_controldir_into_notrees_repo(self): |
646 | 410 | """Cloning into a no-trees repo should not create a working tree""" | 427 | """Cloning into a no-trees repo should not create a working tree""" |
647 | 411 | tree = self.make_branch_and_tree('source') | 428 | tree = self.make_branch_and_tree('source') |
648 | 412 | self.build_tree(['source/foo']) | 429 | self.build_tree(['source/foo']) |
649 | @@ -514,12 +531,12 @@ | |||
650 | 514 | """get_branch_reference should not mask NotBranchErrors.""" | 531 | """get_branch_reference should not mask NotBranchErrors.""" |
651 | 515 | dir = self.make_controldir('source') | 532 | dir = self.make_controldir('source') |
652 | 516 | if dir.has_branch(): | 533 | if dir.has_branch(): |
654 | 517 | # this format does not support branchless bzrdirs. | 534 | # this format does not support branchless controldirs. |
655 | 518 | raise TestNotApplicable("format does not support " | 535 | raise TestNotApplicable("format does not support " |
656 | 519 | "branchless control directories") | 536 | "branchless control directories") |
657 | 520 | self.assertRaises(errors.NotBranchError, dir.get_branch_reference) | 537 | self.assertRaises(errors.NotBranchError, dir.get_branch_reference) |
658 | 521 | 538 | ||
660 | 522 | def test_sprout_bzrdir_empty(self): | 539 | def test_sprout_controldir_empty(self): |
661 | 523 | dir = self.make_controldir('source') | 540 | dir = self.make_controldir('source') |
662 | 524 | target = dir.sprout(self.get_url('target')) | 541 | target = dir.sprout(self.get_url('target')) |
663 | 525 | self.assertNotEqual(dir.control_transport.base, | 542 | self.assertNotEqual(dir.control_transport.base, |
664 | @@ -529,7 +546,7 @@ | |||
665 | 529 | target.open_branch() | 546 | target.open_branch() |
666 | 530 | self.openWorkingTreeIfLocal(target) | 547 | self.openWorkingTreeIfLocal(target) |
667 | 531 | 548 | ||
669 | 532 | def test_sprout_bzrdir_empty_under_shared_repo(self): | 549 | def test_sprout_controldir_empty_under_shared_repo(self): |
670 | 533 | # sprouting an empty dir into a repo uses the repo | 550 | # sprouting an empty dir into a repo uses the repo |
671 | 534 | dir = self.make_controldir('source') | 551 | dir = self.make_controldir('source') |
672 | 535 | try: | 552 | try: |
673 | @@ -543,13 +560,13 @@ | |||
674 | 543 | try: | 560 | try: |
675 | 544 | target.open_workingtree() | 561 | target.open_workingtree() |
676 | 545 | except errors.NoWorkingTree: | 562 | except errors.NoWorkingTree: |
678 | 546 | # Some bzrdirs can never have working trees. | 563 | # Some controldirs can never have working trees. |
679 | 547 | repo = target.find_repository() | 564 | repo = target.find_repository() |
680 | 548 | self.assertFalse(repo.controldir._format.supports_workingtrees) | 565 | self.assertFalse(repo.controldir._format.supports_workingtrees) |
681 | 549 | 566 | ||
683 | 550 | def test_sprout_bzrdir_empty_under_shared_repo_force_new(self): | 567 | def test_sprout_controldir_empty_under_shared_repo_force_new(self): |
684 | 551 | # the force_new_repo parameter should force use of a new repo in an empty | 568 | # the force_new_repo parameter should force use of a new repo in an empty |
686 | 552 | # bzrdir's sprout logic | 569 | # controldir's sprout logic |
687 | 553 | dir = self.make_controldir('source') | 570 | dir = self.make_controldir('source') |
688 | 554 | try: | 571 | try: |
689 | 555 | self.make_repository('target', shared=True) | 572 | self.make_repository('target', shared=True) |
690 | @@ -561,7 +578,7 @@ | |||
691 | 561 | target.open_branch() | 578 | target.open_branch() |
692 | 562 | self.openWorkingTreeIfLocal(target) | 579 | self.openWorkingTreeIfLocal(target) |
693 | 563 | 580 | ||
695 | 564 | def test_sprout_bzrdir_with_repository_to_shared(self): | 581 | def test_sprout_controldir_with_repository_to_shared(self): |
696 | 565 | tree = self.make_branch_and_tree('commit_tree') | 582 | tree = self.make_branch_and_tree('commit_tree') |
697 | 566 | self.build_tree(['commit_tree/foo']) | 583 | self.build_tree(['commit_tree/foo']) |
698 | 567 | tree.add('foo') | 584 | tree.add('foo') |
699 | @@ -583,7 +600,7 @@ | |||
700 | 583 | target.user_transport.base) | 600 | target.user_transport.base) |
701 | 584 | self.assertTrue(shared_repo.has_revision(rev1)) | 601 | self.assertTrue(shared_repo.has_revision(rev1)) |
702 | 585 | 602 | ||
704 | 586 | def test_sprout_bzrdir_repository_branch_both_under_shared(self): | 603 | def test_sprout_controldir_repository_branch_both_under_shared(self): |
705 | 587 | try: | 604 | try: |
706 | 588 | shared_repo = self.make_repository('shared', shared=True) | 605 | shared_repo = self.make_repository('shared', shared=True) |
707 | 589 | except errors.IncompatibleFormat: | 606 | except errors.IncompatibleFormat: |
708 | @@ -609,7 +626,7 @@ | |||
709 | 609 | shared_repo.controldir.transport.base) | 626 | shared_repo.controldir.transport.base) |
710 | 610 | self.assertTrue(shared_repo.has_revision(rev1)) | 627 | self.assertTrue(shared_repo.has_revision(rev1)) |
711 | 611 | 628 | ||
713 | 612 | def test_sprout_bzrdir_repository_branch_only_source_under_shared(self): | 629 | def test_sprout_controldir_repository_branch_only_source_under_shared(self): |
714 | 613 | try: | 630 | try: |
715 | 614 | shared_repo = self.make_repository('shared', shared=True) | 631 | shared_repo = self.make_repository('shared', shared=True) |
716 | 615 | except errors.IncompatibleFormat: | 632 | except errors.IncompatibleFormat: |
717 | @@ -639,7 +656,7 @@ | |||
718 | 639 | dir.transport.base, | 656 | dir.transport.base, |
719 | 640 | shared_repo.controldir.transport.base) | 657 | shared_repo.controldir.transport.base) |
720 | 641 | branch = target.open_branch() | 658 | branch = target.open_branch() |
722 | 642 | # The sprouted bzrdir has a branch, so only revisions referenced by | 659 | # The sprouted controldir has a branch, so only revisions referenced by |
723 | 643 | # that branch are copied, rather than the whole repository. It's an | 660 | # that branch are copied, rather than the whole repository. It's an |
724 | 644 | # empty branch, so none are copied. | 661 | # empty branch, so none are copied. |
725 | 645 | self.assertEqual([], branch.repository.all_revision_ids()) | 662 | self.assertEqual([], branch.repository.all_revision_ids()) |
726 | @@ -647,7 +664,7 @@ | |||
727 | 647 | self.assertTrue(branch.repository.make_working_trees()) | 664 | self.assertTrue(branch.repository.make_working_trees()) |
728 | 648 | self.assertFalse(branch.repository.is_shared()) | 665 | self.assertFalse(branch.repository.is_shared()) |
729 | 649 | 666 | ||
731 | 650 | def test_sprout_bzrdir_repository_under_shared_force_new_repo(self): | 667 | def test_sprout_controldir_repository_under_shared_force_new_repo(self): |
732 | 651 | tree = self.make_branch_and_tree('commit_tree') | 668 | tree = self.make_branch_and_tree('commit_tree') |
733 | 652 | self.build_tree(['commit_tree/foo']) | 669 | self.build_tree(['commit_tree/foo']) |
734 | 653 | tree.add('foo') | 670 | tree.add('foo') |
735 | @@ -670,7 +687,7 @@ | |||
736 | 670 | target.control_transport.base) | 687 | target.control_transport.base) |
737 | 671 | self.assertFalse(shared_repo.has_revision(rev1)) | 688 | self.assertFalse(shared_repo.has_revision(rev1)) |
738 | 672 | 689 | ||
740 | 673 | def test_sprout_bzrdir_repository_revision(self): | 690 | def test_sprout_controldir_repository_revision(self): |
741 | 674 | # test for revision limiting, [smoke test, not corner case checks]. | 691 | # test for revision limiting, [smoke test, not corner case checks]. |
742 | 675 | # make a repository with some revisions, | 692 | # make a repository with some revisions, |
743 | 676 | # and sprout it with a revision limit. | 693 | # and sprout it with a revision limit. |
744 | @@ -689,7 +706,7 @@ | |||
745 | 689 | self.sproutOrSkip(dir, self.get_url('target'), revision_id=rev2) | 706 | self.sproutOrSkip(dir, self.get_url('target'), revision_id=rev2) |
746 | 690 | raise TestSkipped('revision limiting not strict yet') | 707 | raise TestSkipped('revision limiting not strict yet') |
747 | 691 | 708 | ||
749 | 692 | def test_sprout_bzrdir_branch_and_repo_shared(self): | 709 | def test_sprout_controldir_branch_and_repo_shared(self): |
750 | 693 | # sprouting a branch with a repo into a shared repo uses the shared | 710 | # sprouting a branch with a repo into a shared repo uses the shared |
751 | 694 | # repo | 711 | # repo |
752 | 695 | tree = self.make_branch_and_tree('commit_tree') | 712 | tree = self.make_branch_and_tree('commit_tree') |
753 | @@ -708,7 +725,7 @@ | |||
754 | 708 | dir.sprout(self.get_url('target/child')) | 725 | dir.sprout(self.get_url('target/child')) |
755 | 709 | self.assertTrue(shared_repo.has_revision(rev1)) | 726 | self.assertTrue(shared_repo.has_revision(rev1)) |
756 | 710 | 727 | ||
758 | 711 | def test_sprout_bzrdir_branch_and_repo_shared_force_new_repo(self): | 728 | def test_sprout_controldir_branch_and_repo_shared_force_new_repo(self): |
759 | 712 | # sprouting a branch with a repo into a shared repo uses the shared | 729 | # sprouting a branch with a repo into a shared repo uses the shared |
760 | 713 | # repo | 730 | # repo |
761 | 714 | tree = self.make_branch_and_tree('commit_tree') | 731 | tree = self.make_branch_and_tree('commit_tree') |
762 | @@ -729,7 +746,7 @@ | |||
763 | 729 | dir.control_transport.base, target.control_transport.base) | 746 | dir.control_transport.base, target.control_transport.base) |
764 | 730 | self.assertFalse(shared_repo.has_revision(rev1)) | 747 | self.assertFalse(shared_repo.has_revision(rev1)) |
765 | 731 | 748 | ||
767 | 732 | def test_sprout_bzrdir_branch_reference(self): | 749 | def test_sprout_controldir_branch_reference(self): |
768 | 733 | # sprouting should create a repository if needed and a sprouted branch. | 750 | # sprouting should create a repository if needed and a sprouted branch. |
769 | 734 | referenced_branch = self.make_branch('referenced') | 751 | referenced_branch = self.make_branch('referenced') |
770 | 735 | dir = self.make_controldir('source') | 752 | dir = self.make_controldir('source') |
771 | @@ -747,7 +764,7 @@ | |||
772 | 747 | # place | 764 | # place |
773 | 748 | target.open_repository() | 765 | target.open_repository() |
774 | 749 | 766 | ||
776 | 750 | def test_sprout_bzrdir_branch_reference_shared(self): | 767 | def test_sprout_controldir_branch_reference_shared(self): |
777 | 751 | # sprouting should create a repository if needed and a sprouted branch. | 768 | # sprouting should create a repository if needed and a sprouted branch. |
778 | 752 | referenced_tree = self.make_branch_and_tree('referenced') | 769 | referenced_tree = self.make_branch_and_tree('referenced') |
779 | 753 | rev1 = referenced_tree.commit('1', allow_pointless=True) | 770 | rev1 = referenced_tree.commit('1', allow_pointless=True) |
780 | @@ -773,7 +790,7 @@ | |||
781 | 773 | # and we want revision '1' in the shared repo | 790 | # and we want revision '1' in the shared repo |
782 | 774 | self.assertTrue(shared_repo.has_revision(rev1)) | 791 | self.assertTrue(shared_repo.has_revision(rev1)) |
783 | 775 | 792 | ||
785 | 776 | def test_sprout_bzrdir_branch_reference_shared_force_new_repo(self): | 793 | def test_sprout_controldir_branch_reference_shared_force_new_repo(self): |
786 | 777 | # sprouting should create a repository if needed and a sprouted branch. | 794 | # sprouting should create a repository if needed and a sprouted branch. |
787 | 778 | referenced_tree = self.make_branch_and_tree('referenced') | 795 | referenced_tree = self.make_branch_and_tree('referenced') |
788 | 779 | rev1 = referenced_tree.commit('1', allow_pointless=True) | 796 | rev1 = referenced_tree.commit('1', allow_pointless=True) |
789 | @@ -799,7 +816,7 @@ | |||
790 | 799 | # but not the shared one | 816 | # but not the shared one |
791 | 800 | self.assertFalse(shared_repo.has_revision(rev1)) | 817 | self.assertFalse(shared_repo.has_revision(rev1)) |
792 | 801 | 818 | ||
794 | 802 | def test_sprout_bzrdir_branch_revision(self): | 819 | def test_sprout_controldir_branch_revision(self): |
795 | 803 | # test for revision limiting, [smoke test, not corner case checks]. | 820 | # test for revision limiting, [smoke test, not corner case checks]. |
796 | 804 | # make a repository with some revisions, | 821 | # make a repository with some revisions, |
797 | 805 | # and sprout it with a revision limit. | 822 | # and sprout it with a revision limit. |
798 | @@ -816,7 +833,7 @@ | |||
799 | 816 | target = dir.sprout(self.get_url('target'), revision_id=rev1) | 833 | target = dir.sprout(self.get_url('target'), revision_id=rev1) |
800 | 817 | self.assertEqual(rev1, target.open_branch().last_revision()) | 834 | self.assertEqual(rev1, target.open_branch().last_revision()) |
801 | 818 | 835 | ||
803 | 819 | def test_sprout_bzrdir_branch_with_tags(self): | 836 | def test_sprout_controldir_branch_with_tags(self): |
804 | 820 | # when sprouting a branch all revisions named in the tags are copied | 837 | # when sprouting a branch all revisions named in the tags are copied |
805 | 821 | # too. | 838 | # too. |
806 | 822 | builder = self.make_branch_builder('source') | 839 | builder = self.make_branch_builder('source') |
807 | @@ -835,7 +852,7 @@ | |||
808 | 835 | self.assertEqual(rev2, new_branch.tags.lookup_tag('tag-a')) | 852 | self.assertEqual(rev2, new_branch.tags.lookup_tag('tag-a')) |
809 | 836 | new_branch.repository.get_revision(rev2) | 853 | new_branch.repository.get_revision(rev2) |
810 | 837 | 854 | ||
812 | 838 | def test_sprout_bzrdir_branch_with_absent_tag(self): | 855 | def test_sprout_controldir_branch_with_absent_tag(self): |
813 | 839 | # tags referencing absent revisions are copied (and those absent | 856 | # tags referencing absent revisions are copied (and those absent |
814 | 840 | # revisions do not prevent the sprout.) | 857 | # revisions do not prevent the sprout.) |
815 | 841 | builder = self.make_branch_builder('source') | 858 | builder = self.make_branch_builder('source') |
816 | @@ -855,7 +872,7 @@ | |||
817 | 855 | new_branch = target.open_branch() | 872 | new_branch = target.open_branch() |
818 | 856 | self.assertEqual(b'missing-rev', new_branch.tags.lookup_tag('tag-a')) | 873 | self.assertEqual(b'missing-rev', new_branch.tags.lookup_tag('tag-a')) |
819 | 857 | 874 | ||
821 | 858 | def test_sprout_bzrdir_passing_source_branch_with_absent_tag(self): | 875 | def test_sprout_controldir_passing_source_branch_with_absent_tag(self): |
822 | 859 | # tags referencing absent revisions are copied (and those absent | 876 | # tags referencing absent revisions are copied (and those absent |
823 | 860 | # revisions do not prevent the sprout.) | 877 | # revisions do not prevent the sprout.) |
824 | 861 | builder = self.make_branch_builder('source') | 878 | builder = self.make_branch_builder('source') |
825 | @@ -875,9 +892,9 @@ | |||
826 | 875 | new_branch = target.open_branch() | 892 | new_branch = target.open_branch() |
827 | 876 | self.assertEqual(b'missing-rev', new_branch.tags.lookup_tag('tag-a')) | 893 | self.assertEqual(b'missing-rev', new_branch.tags.lookup_tag('tag-a')) |
828 | 877 | 894 | ||
830 | 878 | def test_sprout_bzrdir_passing_rev_not_source_branch_copies_tags(self): | 895 | def test_sprout_controldir_passing_rev_not_source_branch_copies_tags(self): |
831 | 879 | # dir.sprout(..., revision_id=b'rev1') copies rev1, and all the tags of | 896 | # dir.sprout(..., revision_id=b'rev1') copies rev1, and all the tags of |
833 | 880 | # the branch at that bzrdir, the ancestry of all of those, but no other | 897 | # the branch at that controldir, the ancestry of all of those, but no other |
834 | 881 | # revs (not even the tip of the source branch). | 898 | # revs (not even the tip of the source branch). |
835 | 882 | builder = self.make_branch_builder('source') | 899 | builder = self.make_branch_builder('source') |
836 | 883 | base_rev = builder.build_commit(message="Base") | 900 | base_rev = builder.build_commit(message="Base") |
837 | @@ -927,7 +944,7 @@ | |||
838 | 927 | sorted([base_rev, rev_b1, rev_b2, rev_c1, rev_c2]), | 944 | sorted([base_rev, rev_b1, rev_b2, rev_c1, rev_c2]), |
839 | 928 | sorted(new_branch.repository.all_revision_ids())) | 945 | sorted(new_branch.repository.all_revision_ids())) |
840 | 929 | 946 | ||
842 | 930 | def test_sprout_bzrdir_tree_branch_reference(self): | 947 | def test_sprout_controldir_tree_branch_reference(self): |
843 | 931 | # sprouting should create a repository if needed and a sprouted branch. | 948 | # sprouting should create a repository if needed and a sprouted branch. |
844 | 932 | # the tree state should not be copied. | 949 | # the tree state should not be copied. |
845 | 933 | referenced_branch = self.make_branch('referencced') | 950 | referenced_branch = self.make_branch('referencced') |
846 | @@ -952,7 +969,7 @@ | |||
847 | 952 | result_tree = target.open_workingtree() | 969 | result_tree = target.open_workingtree() |
848 | 953 | self.assertFalse(result_tree.has_filename('subdir')) | 970 | self.assertFalse(result_tree.has_filename('subdir')) |
849 | 954 | 971 | ||
851 | 955 | def test_sprout_bzrdir_tree_branch_reference_revision(self): | 972 | def test_sprout_controldir_tree_branch_reference_revision(self): |
852 | 956 | # sprouting should create a repository if needed and a sprouted branch. | 973 | # sprouting should create a repository if needed and a sprouted branch. |
853 | 957 | # the tree state should not be copied but the revision changed, | 974 | # the tree state should not be copied but the revision changed, |
854 | 958 | # and the likewise the new branch should be truncated too | 975 | # and the likewise the new branch should be truncated too |
855 | @@ -982,7 +999,7 @@ | |||
856 | 982 | self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) | 999 | self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) |
857 | 983 | self.assertEqual(rev1, target.open_branch().last_revision()) | 1000 | self.assertEqual(rev1, target.open_branch().last_revision()) |
858 | 984 | 1001 | ||
860 | 985 | def test_sprout_bzrdir_tree_revision(self): | 1002 | def test_sprout_controldir_tree_revision(self): |
861 | 986 | # test for revision limiting, [smoke test, not corner case checks]. | 1003 | # test for revision limiting, [smoke test, not corner case checks]. |
862 | 987 | # make a tree with a revision with a last-revision | 1004 | # make a tree with a revision with a last-revision |
863 | 988 | # and sprout it with a revision limit. | 1005 | # and sprout it with a revision limit. |
864 | @@ -1034,13 +1051,13 @@ | |||
865 | 1034 | rev3 = builder.build_commit(message='Rev 3.') | 1051 | rev3 = builder.build_commit(message='Rev 3.') |
866 | 1035 | builder.finish_series() | 1052 | builder.finish_series() |
867 | 1036 | stack_on = builder.get_branch() | 1053 | stack_on = builder.get_branch() |
869 | 1037 | # Make a bzrdir with a default stacking policy to stack on that branch. | 1054 | # Make a controldir with a default stacking policy to stack on that branch. |
870 | 1038 | config = self.make_controldir('policy-dir').get_config() | 1055 | config = self.make_controldir('policy-dir').get_config() |
871 | 1039 | try: | 1056 | try: |
872 | 1040 | config.set_default_stack_on(self.get_url('stack-on')) | 1057 | config.set_default_stack_on(self.get_url('stack-on')) |
873 | 1041 | except errors.BzrError: | 1058 | except errors.BzrError: |
874 | 1042 | raise TestNotApplicable('Only relevant for stackable formats.') | 1059 | raise TestNotApplicable('Only relevant for stackable formats.') |
876 | 1043 | # Sprout the stacked-on branch into the bzrdir. | 1060 | # Sprout the stacked-on branch into the controldir. |
877 | 1044 | sprouted = stack_on.controldir.sprout( | 1061 | sprouted = stack_on.controldir.sprout( |
878 | 1045 | self.get_url('policy-dir/sprouted'), revision_id=rev3) | 1062 | self.get_url('policy-dir/sprouted'), revision_id=rev3) |
879 | 1046 | # Not all revisions are copied into the sprouted repository. | 1063 | # Not all revisions are copied into the sprouted repository. |
880 | @@ -1288,6 +1305,11 @@ | |||
881 | 1288 | repo.controldir.create_branch() | 1305 | repo.controldir.create_branch() |
882 | 1289 | self.assertEqual([""], list(repo.controldir.get_branches())) | 1306 | self.assertEqual([""], list(repo.controldir.get_branches())) |
883 | 1290 | 1307 | ||
884 | 1308 | def test_branch_names(self): | ||
885 | 1309 | repo = self.make_repository('branch-1') | ||
886 | 1310 | repo.controldir.create_branch() | ||
887 | 1311 | self.assertEqual([""], repo.controldir.branch_names()) | ||
888 | 1312 | |||
889 | 1291 | def test_create_repository(self): | 1313 | def test_create_repository(self): |
890 | 1292 | # a bzrdir can construct a repository for itself. | 1314 | # a bzrdir can construct a repository for itself. |
891 | 1293 | if not self.bzrdir_format.is_initializable(): | 1315 | if not self.bzrdir_format.is_initializable(): |
892 | 1294 | 1316 | ||
893 | === modified file 'breezy/tests/per_controldir_colo/test_supported.py' | |||
894 | --- breezy/tests/per_controldir_colo/test_supported.py 2019-04-13 21:37:04 +0000 | |||
895 | +++ breezy/tests/per_controldir_colo/test_supported.py 2020-03-22 21:30:11 +0000 | |||
896 | @@ -184,6 +184,11 @@ | |||
897 | 184 | self.assertEqual(target_branch.base, | 184 | self.assertEqual(target_branch.base, |
898 | 185 | repo.controldir.get_branches()['foo'].base) | 185 | repo.controldir.get_branches()['foo'].base) |
899 | 186 | 186 | ||
900 | 187 | def test_branch_names(self): | ||
901 | 188 | repo = self.make_repository('branch-1') | ||
902 | 189 | target_branch = self.create_branch(repo.controldir, name='foo') | ||
903 | 190 | self.assertIn('foo', repo.controldir.branch_names()) | ||
904 | 191 | |||
905 | 187 | def test_branch_name_with_slash(self): | 192 | def test_branch_name_with_slash(self): |
906 | 188 | repo = self.make_repository('branch-1') | 193 | repo = self.make_repository('branch-1') |
907 | 189 | try: | 194 | try: |
908 | 190 | 195 | ||
909 | === modified file 'breezy/tests/test_smart.py' | |||
910 | --- breezy/tests/test_smart.py 2020-01-18 02:42:17 +0000 | |||
911 | +++ breezy/tests/test_smart.py 2020-03-22 21:30:11 +0000 | |||
912 | @@ -485,6 +485,19 @@ | |||
913 | 485 | (b"success", ), local_result) | 485 | (b"success", ), local_result) |
914 | 486 | self.assertEqual(expected, request.execute(b'')) | 486 | self.assertEqual(expected, request.execute(b'')) |
915 | 487 | 487 | ||
916 | 488 | def test_ref(self): | ||
917 | 489 | backing = self.get_transport() | ||
918 | 490 | dir = self.make_controldir('foo') | ||
919 | 491 | b = self.make_branch('bar') | ||
920 | 492 | dir.set_branch_reference(b) | ||
921 | 493 | request_class = smart_dir.SmartServerBzrDirRequestGetBranches | ||
922 | 494 | request = request_class(backing) | ||
923 | 495 | local_result = bencode.bencode( | ||
924 | 496 | {b"": (b"ref", b'../bar/')}) | ||
925 | 497 | expected = smart_req.SuccessfulSmartServerResponse( | ||
926 | 498 | (b"success", ), local_result) | ||
927 | 499 | self.assertEqual(expected, request.execute(b'foo')) | ||
928 | 500 | |||
929 | 488 | def test_empty(self): | 501 | def test_empty(self): |
930 | 489 | backing = self.get_transport() | 502 | backing = self.get_transport() |
931 | 490 | self.make_controldir('.') | 503 | self.make_controldir('.') |
932 | 491 | 504 | ||
933 | === modified file 'doc/en/release-notes/brz-3.1.txt' | |||
934 | --- doc/en/release-notes/brz-3.1.txt 2020-03-21 20:56:33 +0000 | |||
935 | +++ doc/en/release-notes/brz-3.1.txt 2020-03-22 21:30:11 +0000 | |||
936 | @@ -73,6 +73,13 @@ | |||
937 | 73 | * When pushing to Git repositories, symrefs are now followed. | 73 | * When pushing to Git repositories, symrefs are now followed. |
938 | 74 | (Jelmer Vernooij, #1800393) | 74 | (Jelmer Vernooij, #1800393) |
939 | 75 | 75 | ||
940 | 76 | * New ``brz clone`` command, which clones everything under | ||
941 | 77 | a control directory. I.e. all colocated branches, like | ||
942 | 78 | ``git clone``. (Jelmer Vernooij, #831939) | ||
943 | 79 | |||
944 | 80 | * ``brz sprout`` is now an alias for ``brz branch``. | ||
945 | 81 | (Jelmer Vernooij) | ||
946 | 82 | |||
947 | 76 | Improvements | 83 | Improvements |
948 | 77 | ************ | 84 | ************ |
949 | 78 | 85 |
Running landing tests failed /ci.breezy- vcs.org/ job/brz- 3.1/job/ brz-3.1- land/4/
https:/