Merge lp:~jelmer/brz/git-submodule into lp:brz
- git-submodule
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Rejected |
---|---|
Rejected by: | Jelmer Vernooij |
Proposed branch: | lp:~jelmer/brz/git-submodule |
Merge into: | lp:brz |
Diff against target: |
463 lines (+146/-43) 15 files modified
breezy/branch.py (+10/-12) breezy/builtins.py (+6/-5) breezy/bzr/branch.py (+8/-0) breezy/bzr/bzrdir.py (+7/-1) breezy/bzr/workingtree.py (+7/-0) breezy/bzr/workingtree_4.py (+18/-14) breezy/git/branch.py (+15/-0) breezy/git/dir.py (+6/-1) breezy/git/fetch.py (+3/-3) breezy/git/workingtree.py (+33/-0) breezy/merge.py (+1/-1) breezy/tests/blackbox/test_branch.py (+15/-0) breezy/tests/blackbox/test_reference.py (+2/-0) breezy/tests/per_branch/test_branch.py (+5/-6) breezy/workingtree.py (+10/-0) |
To merge this branch: | bzr merge lp:~jelmer/brz/git-submodule |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+377752@code.launchpad.net |
Commit message
Fix cloning of git repositories with submodules.
Description of the change
Fix cloning of git repositories with submodules.
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:/
Unmerged revisions
- 7454. By Jelmer Vernooij
-
Use strip_segment_
parameters. - 7453. By Jelmer Vernooij
-
Ignore missing nested trees.
- 7452. By Jelmer Vernooij
-
Fix typo.
- 7451. By Jelmer Vernooij
-
Import from gitmodules.
- 7450. By Jelmer Vernooij
-
Use find_previous_path rather than id2path.
- 7449. By Jelmer Vernooij
-
Fix tree reference listing.
- 7448. By Jelmer Vernooij
-
Move reference info to Git.
- 7447. By Jelmer Vernooij
-
Fix cloning of git repositories with submodules.
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 2019-10-19 23:18:56 +0000 | |||
3 | +++ breezy/branch.py 2020-01-17 02:30:07 +0000 | |||
4 | @@ -51,7 +51,7 @@ | |||
5 | 51 | text_type, | 51 | text_type, |
6 | 52 | viewitems, | 52 | viewitems, |
7 | 53 | ) | 53 | ) |
9 | 54 | from .trace import mutter, mutter_callsite, note, is_quiet | 54 | from .trace import mutter, mutter_callsite, note, is_quiet, warning |
10 | 55 | 55 | ||
11 | 56 | 56 | ||
12 | 57 | class UnstackableBranchFormat(errors.BzrError): | 57 | class UnstackableBranchFormat(errors.BzrError): |
13 | @@ -676,14 +676,6 @@ | |||
14 | 676 | raise errors.UpgradeRequired(self.user_url) | 676 | raise errors.UpgradeRequired(self.user_url) |
15 | 677 | self.get_config_stack().set('append_revisions_only', enabled) | 677 | self.get_config_stack().set('append_revisions_only', enabled) |
16 | 678 | 678 | ||
17 | 679 | def set_reference_info(self, tree_path, branch_location, file_id=None): | ||
18 | 680 | """Set the branch location to use for a tree reference.""" | ||
19 | 681 | raise errors.UnsupportedOperation(self.set_reference_info, self) | ||
20 | 682 | |||
21 | 683 | def get_reference_info(self, path): | ||
22 | 684 | """Get the tree_path and branch_location for a tree reference.""" | ||
23 | 685 | raise errors.UnsupportedOperation(self.get_reference_info, self) | ||
24 | 686 | |||
25 | 687 | def fetch(self, from_branch, last_revision=None, limit=None): | 679 | def fetch(self, from_branch, last_revision=None, limit=None): |
26 | 688 | """Copy revisions from from_branch into this branch. | 680 | """Copy revisions from from_branch into this branch. |
27 | 689 | 681 | ||
28 | @@ -1412,7 +1404,10 @@ | |||
29 | 1412 | basis_tree = tree.basis_tree() | 1404 | basis_tree = tree.basis_tree() |
30 | 1413 | with basis_tree.lock_read(): | 1405 | with basis_tree.lock_read(): |
31 | 1414 | for path in basis_tree.iter_references(): | 1406 | for path in basis_tree.iter_references(): |
33 | 1415 | reference_parent = self.reference_parent(path) | 1407 | reference_parent = tree.reference_parent(path) |
34 | 1408 | if reference_parent is None: | ||
35 | 1409 | warning('Branch location for %s unknown.', path) | ||
36 | 1410 | continue | ||
37 | 1416 | reference_parent.create_checkout( | 1411 | reference_parent.create_checkout( |
38 | 1417 | tree.abspath(path), | 1412 | tree.abspath(path), |
39 | 1418 | basis_tree.get_reference_revision(path), lightweight) | 1413 | basis_tree.get_reference_revision(path), lightweight) |
40 | @@ -1432,8 +1427,11 @@ | |||
41 | 1432 | :return: A branch associated with the nested tree | 1427 | :return: A branch associated with the nested tree |
42 | 1433 | """ | 1428 | """ |
43 | 1434 | # FIXME should provide multiple branches, based on config | 1429 | # FIXME should provide multiple branches, based on config |
46 | 1435 | return Branch.open(self.controldir.root_transport.clone(path).base, | 1430 | try: |
47 | 1436 | possible_transports=possible_transports) | 1431 | return Branch.open(self.controldir.root_transport.clone(path).base, |
48 | 1432 | possible_transports=possible_transports) | ||
49 | 1433 | except errors.NotBranchError: | ||
50 | 1434 | return None | ||
51 | 1437 | 1435 | ||
52 | 1438 | def supports_tags(self): | 1436 | def supports_tags(self): |
53 | 1439 | return self._format.supports_tags() | 1437 | return self._format.supports_tags() |
54 | 1440 | 1438 | ||
55 | === modified file 'breezy/builtins.py' | |||
56 | --- breezy/builtins.py 2020-01-12 14:46:56 +0000 | |||
57 | +++ breezy/builtins.py 2020-01-17 02:30:07 +0000 | |||
58 | @@ -6738,21 +6738,22 @@ | |||
59 | 6738 | if tree is None: | 6738 | if tree is None: |
60 | 6739 | tree = branch.basis_tree() | 6739 | tree = branch.basis_tree() |
61 | 6740 | if path is None: | 6740 | if path is None: |
63 | 6741 | info = viewitems(branch._get_all_reference_info()) | 6741 | info = [ |
64 | 6742 | (path, tree.get_reference_info(path)) | ||
65 | 6743 | for path in tree.iter_references()] | ||
66 | 6742 | self._display_reference_info(tree, branch, info) | 6744 | self._display_reference_info(tree, branch, info) |
67 | 6743 | else: | 6745 | else: |
68 | 6744 | if not tree.is_versioned(path) and not force_unversioned: | 6746 | if not tree.is_versioned(path) and not force_unversioned: |
69 | 6745 | raise errors.NotVersionedError(path) | 6747 | raise errors.NotVersionedError(path) |
70 | 6746 | if location is None: | 6748 | if location is None: |
72 | 6747 | info = [(path, branch.get_reference_info(path))] | 6749 | info = [(path, tree.get_reference_info(path))] |
73 | 6748 | self._display_reference_info(tree, branch, info) | 6750 | self._display_reference_info(tree, branch, info) |
74 | 6749 | else: | 6751 | else: |
77 | 6750 | branch.set_reference_info( | 6752 | tree.set_reference_info(path, location) |
76 | 6751 | path, location, file_id=tree.path2id(path)) | ||
78 | 6752 | 6753 | ||
79 | 6753 | def _display_reference_info(self, tree, branch, info): | 6754 | def _display_reference_info(self, tree, branch, info): |
80 | 6754 | ref_list = [] | 6755 | ref_list = [] |
82 | 6755 | for path, (location, file_id) in info: | 6756 | for path, location in info: |
83 | 6756 | ref_list.append((path, location)) | 6757 | ref_list.append((path, location)) |
84 | 6757 | for path, location in sorted(ref_list): | 6758 | for path, location in sorted(ref_list): |
85 | 6758 | self.outf.write('%s %s\n' % (path, location)) | 6759 | self.outf.write('%s %s\n' % (path, location)) |
86 | 6759 | 6760 | ||
87 | === modified file 'breezy/bzr/branch.py' | |||
88 | --- breezy/bzr/branch.py 2020-01-12 13:56:10 +0000 | |||
89 | +++ breezy/bzr/branch.py 2020-01-17 02:30:07 +0000 | |||
90 | @@ -450,6 +450,14 @@ | |||
91 | 450 | reconciler = BranchReconciler(self, thorough=thorough) | 450 | reconciler = BranchReconciler(self, thorough=thorough) |
92 | 451 | return reconciler.reconcile() | 451 | return reconciler.reconcile() |
93 | 452 | 452 | ||
94 | 453 | def set_reference_info(self, tree_path, branch_location, file_id=None): | ||
95 | 454 | """Set the branch location to use for a tree reference.""" | ||
96 | 455 | raise errors.UnsupportedOperation(self.set_reference_info, self) | ||
97 | 456 | |||
98 | 457 | def get_reference_info(self, path): | ||
99 | 458 | """Get the tree_path and branch_location for a tree reference.""" | ||
100 | 459 | raise errors.UnsupportedOperation(self.get_reference_info, self) | ||
101 | 460 | |||
102 | 453 | 461 | ||
103 | 454 | class BzrBranch8(BzrBranch): | 462 | class BzrBranch8(BzrBranch): |
104 | 455 | """A branch that stores tree-reference locations.""" | 463 | """A branch that stores tree-reference locations.""" |
105 | 456 | 464 | ||
106 | === modified file 'breezy/bzr/bzrdir.py' | |||
107 | --- breezy/bzr/bzrdir.py 2019-10-20 00:11:04 +0000 | |||
108 | +++ breezy/bzr/bzrdir.py 2020-01-17 02:30:07 +0000 | |||
109 | @@ -65,6 +65,7 @@ | |||
110 | 65 | from ..trace import ( | 65 | from ..trace import ( |
111 | 66 | mutter, | 66 | mutter, |
112 | 67 | note, | 67 | note, |
113 | 68 | warning, | ||
114 | 68 | ) | 69 | ) |
115 | 69 | 70 | ||
116 | 70 | from .. import ( | 71 | from .. import ( |
117 | @@ -467,8 +468,13 @@ | |||
118 | 467 | subtrees = [] | 468 | subtrees = [] |
119 | 468 | for path in subtrees: | 469 | for path in subtrees: |
120 | 469 | target = urlutils.join(url, urlutils.escape(path)) | 470 | target = urlutils.join(url, urlutils.escape(path)) |
122 | 470 | sublocation = source_branch.reference_parent( | 471 | sublocation = wt.reference_parent( |
123 | 471 | path, possible_transports=possible_transports) | 472 | path, possible_transports=possible_transports) |
124 | 473 | if sublocation is None: | ||
125 | 474 | warning( | ||
126 | 475 | 'Ignoring nested tree %s, parent location unknown.', | ||
127 | 476 | path) | ||
128 | 477 | continue | ||
129 | 472 | sublocation.controldir.sprout( | 478 | sublocation.controldir.sprout( |
130 | 473 | target, basis.get_reference_revision(path), | 479 | target, basis.get_reference_revision(path), |
131 | 474 | force_new_repo=force_new_repo, recurse=recurse, | 480 | force_new_repo=force_new_repo, recurse=recurse, |
132 | 475 | 481 | ||
133 | === modified file 'breezy/bzr/workingtree.py' | |||
134 | --- breezy/bzr/workingtree.py 2020-01-11 02:39:17 +0000 | |||
135 | +++ breezy/bzr/workingtree.py 2020-01-17 02:30:07 +0000 | |||
136 | @@ -1796,6 +1796,13 @@ | |||
137 | 1796 | else: | 1796 | else: |
138 | 1797 | yield get_canonical_path(self, path, normalize) | 1797 | yield get_canonical_path(self, path, normalize) |
139 | 1798 | 1798 | ||
140 | 1799 | def get_reference_info(self, path): | ||
141 | 1800 | return self.branch.get_reference_info(path)[0] | ||
142 | 1801 | |||
143 | 1802 | def set_reference_info(self, tree_path, branch_location): | ||
144 | 1803 | self.branch.set_reference_info( | ||
145 | 1804 | tree_path, branch_location, file_id=self.path2id(tree_path)) | ||
146 | 1805 | |||
147 | 1799 | 1806 | ||
148 | 1800 | class WorkingTreeFormatMetaDir(bzrdir.BzrFormat, WorkingTreeFormat): | 1807 | class WorkingTreeFormatMetaDir(bzrdir.BzrFormat, WorkingTreeFormat): |
149 | 1801 | """Base class for working trees that live in bzr meta directories.""" | 1808 | """Base class for working trees that live in bzr meta directories.""" |
150 | 1802 | 1809 | ||
151 | === modified file 'breezy/bzr/workingtree_4.py' | |||
152 | --- breezy/bzr/workingtree_4.py 2020-01-11 22:33:18 +0000 | |||
153 | +++ breezy/bzr/workingtree_4.py 2020-01-17 02:30:07 +0000 | |||
154 | @@ -130,6 +130,9 @@ | |||
155 | 130 | self.views = self._make_views() | 130 | self.views = self._make_views() |
156 | 131 | # --- allow tests to select the dirstate iter_changes implementation | 131 | # --- allow tests to select the dirstate iter_changes implementation |
157 | 132 | self._iter_changes = dirstate._process_entry | 132 | self._iter_changes = dirstate._process_entry |
158 | 133 | self._repo_supports_tree_reference = getattr( | ||
159 | 134 | self._branch.repository._format, "supports_tree_reference", | ||
160 | 135 | False) | ||
161 | 133 | 136 | ||
162 | 134 | def _add(self, files, ids, kinds): | 137 | def _add(self, files, ids, kinds): |
163 | 135 | """See MutableTree._add.""" | 138 | """See MutableTree._add.""" |
164 | @@ -550,20 +553,21 @@ | |||
165 | 550 | # When the repo doesn't support references, we will have nothing to | 553 | # When the repo doesn't support references, we will have nothing to |
166 | 551 | # return | 554 | # return |
167 | 552 | return | 555 | return |
182 | 553 | for key, tree_details in self.current_dirstate()._iter_entries(): | 556 | with self.lock_read(): |
183 | 554 | if tree_details[0][0] in (b'a', b'r'): # absent, relocated | 557 | for key, tree_details in self.current_dirstate()._iter_entries(): |
184 | 555 | # not relevant to the working tree | 558 | if tree_details[0][0] in (b'a', b'r'): # absent, relocated |
185 | 556 | continue | 559 | # not relevant to the working tree |
186 | 557 | if not key[1]: | 560 | continue |
187 | 558 | # the root is not a reference. | 561 | if not key[1]: |
188 | 559 | continue | 562 | # the root is not a reference. |
189 | 560 | relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8')) | 563 | continue |
190 | 561 | try: | 564 | relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8')) |
191 | 562 | if self.kind(relpath) == 'tree-reference': | 565 | try: |
192 | 563 | yield relpath | 566 | if self.kind(relpath) == 'tree-reference': |
193 | 564 | except errors.NoSuchFile: | 567 | yield relpath |
194 | 565 | # path is missing on disk. | 568 | except errors.NoSuchFile: |
195 | 566 | continue | 569 | # path is missing on disk. |
196 | 570 | continue | ||
197 | 567 | 571 | ||
198 | 568 | def _observed_sha1(self, path, sha_and_stat): | 572 | def _observed_sha1(self, path, sha_and_stat): |
199 | 569 | """See MutableTree._observed_sha1.""" | 573 | """See MutableTree._observed_sha1.""" |
200 | 570 | 574 | ||
201 | === modified file 'breezy/git/branch.py' | |||
202 | --- breezy/git/branch.py 2020-01-16 23:24:40 +0000 | |||
203 | +++ breezy/git/branch.py 2020-01-17 02:30:07 +0000 | |||
204 | @@ -22,6 +22,10 @@ | |||
205 | 22 | from io import BytesIO | 22 | from io import BytesIO |
206 | 23 | from collections import defaultdict | 23 | from collections import defaultdict |
207 | 24 | 24 | ||
208 | 25 | from dulwich.config import ( | ||
209 | 26 | ConfigFile as GitConfigFile, | ||
210 | 27 | parse_submodules, | ||
211 | 28 | ) | ||
212 | 25 | from dulwich.objects import ( | 29 | from dulwich.objects import ( |
213 | 26 | NotCommitError, | 30 | NotCommitError, |
214 | 27 | ZERO_SHA, | 31 | ZERO_SHA, |
215 | @@ -980,6 +984,15 @@ | |||
216 | 980 | other_branch=self.source) | 984 | other_branch=self.source) |
217 | 981 | return head, refs | 985 | return head, refs |
218 | 982 | 986 | ||
219 | 987 | def _import_tree_references(self, revid): | ||
220 | 988 | tree = self.target.repository.revision_tree(revid) | ||
221 | 989 | with tree.get_file('.gitmodules') as f: | ||
222 | 990 | for path, url, section in parse_submodules( | ||
223 | 991 | GitConfigFile.from_file(f)): | ||
224 | 992 | self.target.set_reference_info( | ||
225 | 993 | path.decode('utf-8'), url.decode('utf-8'), | ||
226 | 994 | tree.path2id(path.decode('utf-8'))) | ||
227 | 995 | |||
228 | 983 | def _basic_pull(self, stop_revision, overwrite, run_hooks, | 996 | def _basic_pull(self, stop_revision, overwrite, run_hooks, |
229 | 984 | _override_hook_target, _hook_master): | 997 | _override_hook_target, _hook_master): |
230 | 985 | if overwrite is True: | 998 | if overwrite is True: |
231 | @@ -1007,6 +1020,7 @@ | |||
232 | 1007 | result.tag_conflicts = tags_ret | 1020 | result.tag_conflicts = tags_ret |
233 | 1008 | (result.new_revno, result.new_revid) = \ | 1021 | (result.new_revno, result.new_revid) = \ |
234 | 1009 | self.target.last_revision_info() | 1022 | self.target.last_revision_info() |
235 | 1023 | self._import_tree_references(result.new_revid) | ||
236 | 1010 | if _hook_master: | 1024 | if _hook_master: |
237 | 1011 | result.master_branch = _hook_master | 1025 | result.master_branch = _hook_master |
238 | 1012 | result.local_branch = result.target_branch | 1026 | result.local_branch = result.target_branch |
239 | @@ -1075,6 +1089,7 @@ | |||
240 | 1075 | self.target.tags, "tags" in overwrite, ignore_master=True) | 1089 | self.target.tags, "tags" in overwrite, ignore_master=True) |
241 | 1076 | (result.tag_updates, result.tag_conflicts) = tags_ret | 1090 | (result.tag_updates, result.tag_conflicts) = tags_ret |
242 | 1077 | result.new_revno, result.new_revid = self.target.last_revision_info() | 1091 | result.new_revno, result.new_revid = self.target.last_revision_info() |
243 | 1092 | self._import_tree_references(result.new_revid) | ||
244 | 1078 | return result | 1093 | return result |
245 | 1079 | 1094 | ||
246 | 1080 | 1095 | ||
247 | 1081 | 1096 | ||
248 | === modified file 'breezy/git/dir.py' | |||
249 | --- breezy/git/dir.py 2020-01-12 14:46:56 +0000 | |||
250 | +++ breezy/git/dir.py 2020-01-17 02:30:07 +0000 | |||
251 | @@ -207,8 +207,13 @@ | |||
252 | 207 | subtrees = [] | 207 | subtrees = [] |
253 | 208 | for path in subtrees: | 208 | for path in subtrees: |
254 | 209 | target = urlutils.join(url, urlutils.escape(path)) | 209 | target = urlutils.join(url, urlutils.escape(path)) |
256 | 210 | sublocation = source_branch.reference_parent( | 210 | sublocation = wt.reference_parent( |
257 | 211 | path, possible_transports=possible_transports) | 211 | path, possible_transports=possible_transports) |
258 | 212 | if sublocation is None: | ||
259 | 213 | trace.warning( | ||
260 | 214 | 'Ignoring nested tree %s, parent location unknown.', | ||
261 | 215 | path) | ||
262 | 216 | continue | ||
263 | 212 | sublocation.controldir.sprout( | 217 | sublocation.controldir.sprout( |
264 | 213 | target, basis.get_reference_revision(path), | 218 | target, basis.get_reference_revision(path), |
265 | 214 | force_new_repo=force_new_repo, recurse=recurse, | 219 | force_new_repo=force_new_repo, recurse=recurse, |
266 | 215 | 220 | ||
267 | === modified file 'breezy/git/fetch.py' | |||
268 | --- breezy/git/fetch.py 2019-10-28 01:38:39 +0000 | |||
269 | +++ breezy/git/fetch.py 2020-01-17 02:30:07 +0000 | |||
270 | @@ -55,6 +55,7 @@ | |||
271 | 55 | from ..bzr.testament import ( | 55 | from ..bzr.testament import ( |
272 | 56 | StrictTestament3, | 56 | StrictTestament3, |
273 | 57 | ) | 57 | ) |
274 | 58 | from ..tree import find_previous_path | ||
275 | 58 | from ..tsort import ( | 59 | from ..tsort import ( |
276 | 59 | topo_sort, | 60 | topo_sort, |
277 | 60 | ) | 61 | ) |
278 | @@ -125,9 +126,8 @@ | |||
279 | 125 | # Check what revision we should store | 126 | # Check what revision we should store |
280 | 126 | parent_keys = [] | 127 | parent_keys = [] |
281 | 127 | for ptree in parent_bzr_trees: | 128 | for ptree in parent_bzr_trees: |
285 | 128 | try: | 129 | ppath = find_previous_path(base_bzr_tree, ptree, decoded_path, file_id) |
286 | 129 | ppath = ptree.id2path(file_id) | 130 | if ppath is None: |
284 | 130 | except errors.NoSuchId: | ||
287 | 131 | continue | 131 | continue |
288 | 132 | pkind = ptree.kind(ppath) | 132 | pkind = ptree.kind(ppath) |
289 | 133 | if (pkind == ie.kind and | 133 | if (pkind == ie.kind and |
290 | 134 | 134 | ||
291 | === modified file 'breezy/git/workingtree.py' | |||
292 | --- breezy/git/workingtree.py 2020-01-10 01:37:30 +0000 | |||
293 | +++ breezy/git/workingtree.py 2020-01-17 02:30:07 +0000 | |||
294 | @@ -25,6 +25,7 @@ | |||
295 | 25 | from dulwich.ignore import ( | 25 | from dulwich.ignore import ( |
296 | 26 | IgnoreFilterManager, | 26 | IgnoreFilterManager, |
297 | 27 | ) | 27 | ) |
298 | 28 | from dulwich.config import ConfigFile as GitConfigFile | ||
299 | 28 | from dulwich.file import GitFile, FileLocked | 29 | from dulwich.file import GitFile, FileLocked |
300 | 29 | from dulwich.index import ( | 30 | from dulwich.index import ( |
301 | 30 | Index, | 31 | Index, |
302 | @@ -49,6 +50,7 @@ | |||
303 | 49 | import sys | 50 | import sys |
304 | 50 | 51 | ||
305 | 51 | from .. import ( | 52 | from .. import ( |
306 | 53 | branch as _mod_branch, | ||
307 | 52 | conflicts as _mod_conflicts, | 54 | conflicts as _mod_conflicts, |
308 | 53 | errors, | 55 | errors, |
309 | 54 | controldir as _mod_controldir, | 56 | controldir as _mod_controldir, |
310 | @@ -1325,6 +1327,37 @@ | |||
311 | 1325 | new_parents = [revision_id] | 1327 | new_parents = [revision_id] |
312 | 1326 | tree.set_parent_ids(new_parents) | 1328 | tree.set_parent_ids(new_parents) |
313 | 1327 | 1329 | ||
314 | 1330 | def reference_parent(self, path, possible_transports=None): | ||
315 | 1331 | remote_url = self.get_reference_info(path) | ||
316 | 1332 | if remote_url is None: | ||
317 | 1333 | trace.warning("Unable to find submodule info for %s", path) | ||
318 | 1334 | return None | ||
319 | 1335 | return _mod_branch.Branch.open(remote_url, possible_transports=possible_transports) | ||
320 | 1336 | |||
321 | 1337 | def get_reference_info(self, path): | ||
322 | 1338 | submodule_info = self._submodule_info() | ||
323 | 1339 | info = submodule_info.get(path.encode('utf-8')) | ||
324 | 1340 | if info is None: | ||
325 | 1341 | return None | ||
326 | 1342 | return info[0].decode('utf-8') | ||
327 | 1343 | |||
328 | 1344 | def set_reference_info(self, tree_path, branch_location): | ||
329 | 1345 | path = self.abspath('.gitmodules') | ||
330 | 1346 | try: | ||
331 | 1347 | config = GitConfigFile.from_path(path) | ||
332 | 1348 | except EnvironmentError as e: | ||
333 | 1349 | if e.errno == errno.ENOENT: | ||
334 | 1350 | config = GitConfigFile() | ||
335 | 1351 | else: | ||
336 | 1352 | raise | ||
337 | 1353 | config.set( | ||
338 | 1354 | (b'submodule', tree_path.encode('utf-8')), | ||
339 | 1355 | b'path', tree_path.encode('utf-8')) | ||
340 | 1356 | config.set( | ||
341 | 1357 | (b'submodule', tree_path.encode('utf-8')), | ||
342 | 1358 | b'url', branch_location.encode('utf-8')) | ||
343 | 1359 | config.write_to_path(path) | ||
344 | 1360 | |||
345 | 1328 | 1361 | ||
346 | 1329 | class GitWorkingTreeFormat(workingtree.WorkingTreeFormat): | 1362 | class GitWorkingTreeFormat(workingtree.WorkingTreeFormat): |
347 | 1330 | 1363 | ||
348 | 1331 | 1364 | ||
349 | === modified file 'breezy/merge.py' | |||
350 | --- breezy/merge.py 2019-10-13 17:31:55 +0000 | |||
351 | +++ breezy/merge.py 2020-01-17 02:30:07 +0000 | |||
352 | @@ -641,7 +641,7 @@ | |||
353 | 641 | continue | 641 | continue |
354 | 642 | sub_merge = Merger(sub_tree.branch, this_tree=sub_tree) | 642 | sub_merge = Merger(sub_tree.branch, this_tree=sub_tree) |
355 | 643 | sub_merge.merge_type = self.merge_type | 643 | sub_merge.merge_type = self.merge_type |
357 | 644 | other_branch = self.other_branch.reference_parent(relpath) | 644 | other_branch = self.other_tree.reference_parent(relpath) |
358 | 645 | sub_merge.set_other_revision(other_revision, other_branch) | 645 | sub_merge.set_other_revision(other_revision, other_branch) |
359 | 646 | base_tree_path = _mod_tree.find_previous_path( | 646 | base_tree_path = _mod_tree.find_previous_path( |
360 | 647 | self.this_tree, self.base_tree, relpath) | 647 | self.this_tree, self.base_tree, relpath) |
361 | 648 | 648 | ||
362 | === modified file 'breezy/tests/blackbox/test_branch.py' | |||
363 | --- breezy/tests/blackbox/test_branch.py 2019-10-19 23:18:56 +0000 | |||
364 | +++ breezy/tests/blackbox/test_branch.py 2020-01-17 02:30:07 +0000 | |||
365 | @@ -367,6 +367,7 @@ | |||
366 | 367 | subtree.add(['a']) | 367 | subtree.add(['a']) |
367 | 368 | subtree.commit('add subtree contents') | 368 | subtree.commit('add subtree contents') |
368 | 369 | orig.add_reference(subtree) | 369 | orig.add_reference(subtree) |
369 | 370 | orig.branch.set_reference_info('subtree', subtree.branch.user_url) | ||
370 | 370 | orig.commit('add subtree') | 371 | orig.commit('add subtree') |
371 | 371 | 372 | ||
372 | 372 | self.run_bzr('branch source target') | 373 | self.run_bzr('branch source target') |
373 | @@ -376,6 +377,20 @@ | |||
374 | 376 | self.assertTreesEqual(orig, target) | 377 | self.assertTreesEqual(orig, target) |
375 | 377 | self.assertTreesEqual(subtree, target_subtree) | 378 | self.assertTreesEqual(subtree, target_subtree) |
376 | 378 | 379 | ||
377 | 380 | def test_branch_with_nested_trees_reference_unset(self): | ||
378 | 381 | orig = self.make_branch_and_tree('source', format='development-subtree') | ||
379 | 382 | subtree = self.make_branch_and_tree('source/subtree') | ||
380 | 383 | self.build_tree(['source/subtree/a']) | ||
381 | 384 | subtree.add(['a']) | ||
382 | 385 | subtree.commit('add subtree contents') | ||
383 | 386 | orig.add_reference(subtree) | ||
384 | 387 | orig.commit('add subtree') | ||
385 | 388 | |||
386 | 389 | self.run_bzr('branch source target') | ||
387 | 390 | |||
388 | 391 | target = WorkingTree.open('target') | ||
389 | 392 | self.assertRaises(errors.NotBranchError, WorkingTree.open, 'target/subtree') | ||
390 | 393 | |||
391 | 379 | def test_branch_with_nested_trees_no_recurse(self): | 394 | def test_branch_with_nested_trees_no_recurse(self): |
392 | 380 | orig = self.make_branch_and_tree('source', format='development-subtree') | 395 | orig = self.make_branch_and_tree('source', format='development-subtree') |
393 | 381 | subtree = self.make_branch_and_tree('source/subtree') | 396 | subtree = self.make_branch_and_tree('source/subtree') |
394 | 382 | 397 | ||
395 | === modified file 'breezy/tests/blackbox/test_reference.py' | |||
396 | --- breezy/tests/blackbox/test_reference.py 2018-11-16 11:37:47 +0000 | |||
397 | +++ breezy/tests/blackbox/test_reference.py 2020-01-17 02:30:07 +0000 | |||
398 | @@ -76,6 +76,8 @@ | |||
399 | 76 | tree.add('file', b'file-id') | 76 | tree.add('file', b'file-id') |
400 | 77 | out, err = self.run_bzr('reference tree/file http://example.org') | 77 | out, err = self.run_bzr('reference tree/file http://example.org') |
401 | 78 | location, file_id = tree.branch.get_reference_info('file') | 78 | location, file_id = tree.branch.get_reference_info('file') |
402 | 79 | tree_location = tree.get_reference_info('file') | ||
403 | 80 | self.assertEqual('http://example.org', tree_location) | ||
404 | 79 | self.assertEqual('http://example.org', location) | 81 | self.assertEqual('http://example.org', location) |
405 | 80 | self.assertEqual(b'file-id', file_id) | 82 | self.assertEqual(b'file-id', file_id) |
406 | 81 | self.assertEqual('', out) | 83 | self.assertEqual('', out) |
407 | 82 | 84 | ||
408 | === modified file 'breezy/tests/per_branch/test_branch.py' | |||
409 | --- breezy/tests/per_branch/test_branch.py 2020-01-12 15:16:27 +0000 | |||
410 | +++ breezy/tests/per_branch/test_branch.py 2020-01-17 02:30:07 +0000 | |||
411 | @@ -858,8 +858,8 @@ | |||
412 | 858 | raise tests.TestNotApplicable('Tree cannot hold references.') | 858 | raise tests.TestNotApplicable('Tree cannot hold references.') |
413 | 859 | reference_parent = tree.branch.reference_parent( | 859 | reference_parent = tree.branch.reference_parent( |
414 | 860 | urlutils.relative_url( | 860 | urlutils.relative_url( |
417 | 861 | urlutils.split_segment_parameters(tree.branch.user_url)[0], | 861 | urlutils.strip_segment_parameters(tree.branch.user_url), |
418 | 862 | urlutils.split_segment_parameters(subtree.branch.user_url)[0])) | 862 | urlutils.strip_segment_parameters(subtree.branch.user_url))) |
419 | 863 | self.assertEqual(subtree.branch.user_url, reference_parent.user_url) | 863 | self.assertEqual(subtree.branch.user_url, reference_parent.user_url) |
420 | 864 | 864 | ||
421 | 865 | def test_reference_parent_accepts_possible_transports(self): | 865 | def test_reference_parent_accepts_possible_transports(self): |
422 | @@ -872,8 +872,8 @@ | |||
423 | 872 | raise tests.TestNotApplicable('Tree cannot hold references.') | 872 | raise tests.TestNotApplicable('Tree cannot hold references.') |
424 | 873 | reference_parent = tree.branch.reference_parent( | 873 | reference_parent = tree.branch.reference_parent( |
425 | 874 | urlutils.relative_url( | 874 | urlutils.relative_url( |
428 | 875 | urlutils.split_segment_parameters(tree.branch.user_url)[0], | 875 | urlutils.strip_segment_parameters(tree.branch.user_url), |
429 | 876 | urlutils.split_segment_parameters(subtree.branch.user_url)[0]), | 876 | urlutils.strip_segment_parameters(subtree.branch.user_url)), |
430 | 877 | possible_transports=[subtree.controldir.root_transport]) | 877 | possible_transports=[subtree.controldir.root_transport]) |
431 | 878 | 878 | ||
432 | 879 | def test_get_reference_info(self): | 879 | def test_get_reference_info(self): |
433 | @@ -1014,8 +1014,7 @@ | |||
434 | 1014 | 'branch/new-branch').open_branch() | 1014 | 'branch/new-branch').open_branch() |
435 | 1015 | new_branch.set_reference_info('../foo', '../foo', b'file-id2') | 1015 | new_branch.set_reference_info('../foo', '../foo', b'file-id2') |
436 | 1016 | new_branch.push(branch) | 1016 | new_branch.push(branch) |
439 | 1017 | self.assertEqual('foo', | 1017 | self.assertEqual('foo', branch.get_reference_info('../foo')[0]) |
438 | 1018 | branch.get_reference_info('../foo')[0]) | ||
440 | 1019 | 1018 | ||
441 | 1020 | def test_merge_updates_references(self): | 1019 | def test_merge_updates_references(self): |
442 | 1021 | branch = self.make_branch_with_reference('branch', 'reference') | 1020 | branch = self.make_branch_with_reference('branch', 'reference') |
443 | 1022 | 1021 | ||
444 | === modified file 'breezy/workingtree.py' | |||
445 | --- breezy/workingtree.py 2020-01-11 17:50:28 +0000 | |||
446 | +++ breezy/workingtree.py 2020-01-17 02:30:07 +0000 | |||
447 | @@ -1325,6 +1325,16 @@ | |||
448 | 1325 | with self.lock_read(): | 1325 | with self.lock_read(): |
449 | 1326 | return next(self.get_canonical_paths([path])) | 1326 | return next(self.get_canonical_paths([path])) |
450 | 1327 | 1327 | ||
451 | 1328 | def reference_parent(self, path, possible_transports=None): | ||
452 | 1329 | return self.branch.reference_parent( | ||
453 | 1330 | path, possible_transports=possible_transports) | ||
454 | 1331 | |||
455 | 1332 | def get_reference_info(self, path): | ||
456 | 1333 | raise errors.UnsupportedOperation(self.get_reference_info, self) | ||
457 | 1334 | |||
458 | 1335 | def set_reference_info(self, tree_path, branch_location): | ||
459 | 1336 | raise errors.UnsupportedOperation(self.set_reference_info, self) | ||
460 | 1337 | |||
461 | 1328 | 1338 | ||
462 | 1329 | class WorkingTreeFormatRegistry(ControlComponentFormatRegistry): | 1339 | class WorkingTreeFormatRegistry(ControlComponentFormatRegistry): |
463 | 1330 | """Registry for working tree formats.""" | 1340 | """Registry for working tree formats.""" |
Running landing tests failed /ci.breezy- vcs.org/ job/brz/ job/brz- land/613/
https:/