Merge lp:~jelmer/brz/no-more-path2id into lp:brz/3.3
- no-more-path2id
- Merge into 3.3
Status: | Needs review |
---|---|
Proposed branch: | lp:~jelmer/brz/no-more-path2id |
Merge into: | lp:brz/3.3 |
Diff against target: |
256 lines (+48/-28) 6 files modified
breezy/git/object_store.py (+2/-0) breezy/git/transform.py (+1/-1) breezy/git/tree.py (+11/-9) breezy/git/workingtree.py (+7/-7) breezy/tests/matchers.py (+3/-1) breezy/tests/per_repository/test_commit_builder.py (+24/-10) |
To merge this branch: | bzr merge lp:~jelmer/brz/no-more-path2id |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+432238@code.launchpad.net |
This proposal supersedes a proposal from 2022-08-30.
Commit message
Make GitTree.path2id private.
Description of the change
Make GitTree.path2id private.
Jelmer Vernooij (jelmer) : Posted in a previous version of this proposal | # |
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
Running landing tests failed
https:/
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
Running landing tests failed
https:/
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
Running landing tests failed
https:/
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
Running landing tests failed
https:/
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
Running landing tests failed
https:/
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal | # |
Running landing tests failed
https:/
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/no-more-path2id into lp:brz/3.3 failed. Command exited with 142.
Below is the output from the failed tests.
Collecting setuptools-gettext
Downloading setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: merge3 in /usr/lib/
Collecting python-subunit
Downloading python_
━━
Collecting testtools
Downloading testtools-
━━
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Collecting sphinx-epytext
Downloading sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting sphinx
Downloading sphinx-
━━
Requirement already satisfied: setuptools in ./lib/python3.
Collecting fastimport
Downloading fastimport-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: gpg in /usr/lib/
Requirement already satisfied: httplib2 in /usr/lib/
Collecting keyring
Downloading keyring-
- 7625. By Jelmer Vernooij
-
Merge lp:brz/3.3
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/no-more-path2id into lp:brz/3.3 failed. Command exited with 1.
Below is the output from the failed tests.
Collecting setuptools-gettext
Downloading setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Collecting fastimport
Downloading fastimport-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting python-subunit
Downloading python_
━━
Collecting testtools
Downloading testtools-
━━
Requirement already satisfied: gpg in /usr/lib/
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Requirement already satisfied: setuptools in ./lib/python3.
Collecting sphinx
Downloading sphinx-
━━
Collecting sphinx-epytext
Downloading sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: httplib2 in /usr/lib/
Unmerged revisions
- 7625. By Jelmer Vernooij
-
Merge lp:brz/3.3
- 7624. By Jelmer Vernooij
-
Fix remaining test.
- 7623. By Jelmer Vernooij
-
Fix import.
- 7622. By Jelmer Vernooij
-
Fix matchers.
- 7621. By Jelmer Vernooij
-
supports_file_ids is not a callable.
- 7620. By Jelmer Vernooij
-
Make GitTree.path2id private.
Preview Diff
1 | === modified file 'breezy/git/object_store.py' |
2 | --- breezy/git/object_store.py 2022-07-07 13:03:35 +0000 |
3 | +++ breezy/git/object_store.py 2022-10-27 10:45:09 +0000 |
4 | @@ -500,6 +500,8 @@ |
5 | :param tree: Bazaar revision tree |
6 | :param lossy: Whether to not roundtrip all Bazaar revision data |
7 | """ |
8 | + if not tree.supports_file_ids: |
9 | + raise TypeError('expected tree that supports file ids, not %r' % tree) |
10 | unusual_modes = extract_unusual_modes(rev) |
11 | present_parents = self.repository.has_revisions(rev.parent_ids) |
12 | parent_trees = self.tree_cache.revision_trees( |
13 | |
14 | === modified file 'breezy/git/transform.py' |
15 | --- breezy/git/transform.py 2022-09-22 22:55:28 +0000 |
16 | +++ breezy/git/transform.py 2022-10-27 10:45:09 +0000 |
17 | @@ -1674,7 +1674,7 @@ |
18 | return None |
19 | return annotate.reannotate([old_annotation], lines, default_revision) |
20 | |
21 | - def path2id(self, path): |
22 | + def _path2id(self, path): |
23 | if isinstance(path, list): |
24 | if path == []: |
25 | path = [""] |
26 | |
27 | === modified file 'breezy/git/tree.py' |
28 | --- breezy/git/tree.py 2022-10-02 16:57:16 +0000 |
29 | +++ breezy/git/tree.py 2022-10-27 10:45:09 +0000 |
30 | @@ -332,6 +332,8 @@ |
31 | class GitRevisionTree(revisiontree.RevisionTree, GitTree): |
32 | """Revision tree implementation based on Git objects.""" |
33 | |
34 | + supports_file_ids = False |
35 | + |
36 | def __init__(self, repository, revision_id): |
37 | self._revision_id = revision_id |
38 | self._repository = repository |
39 | @@ -407,7 +409,7 @@ |
40 | def is_versioned(self, path): |
41 | return self.has_filename(path) |
42 | |
43 | - def path2id(self, path): |
44 | + def _path2id(self, path): |
45 | if self.mapping.is_special_file(path): |
46 | return None |
47 | if not self.is_versioned(path): |
48 | @@ -555,7 +557,7 @@ |
49 | return |
50 | |
51 | encoded_path = encode_git_path(path) |
52 | - file_id = self.path2id(path) |
53 | + file_id = self._path2id(path) |
54 | tree = store[tree_sha] |
55 | for name, mode, hexsha in tree.iteritems(): |
56 | if self.mapping.is_special_file(name): |
57 | @@ -577,7 +579,7 @@ |
58 | else: |
59 | specific_files = set([encode_git_path(p) |
60 | for p in specific_files]) |
61 | - todo = deque([(self.store, b"", self.tree, self.path2id(''))]) |
62 | + todo = deque([(self.store, b"", self.tree, self._path2id(''))]) |
63 | if specific_files is None or u"" in specific_files: |
64 | yield u"", self._get_dir_ie(b"", None) |
65 | while todo: |
66 | @@ -601,7 +603,7 @@ |
67 | child_path)])): |
68 | extradirs.append( |
69 | (substore, child_path, hexsha, |
70 | - self.path2id(child_path_decoded))) |
71 | + self._path2id(child_path_decoded))) |
72 | if specific_files is None or child_path in specific_files: |
73 | if stat.S_ISDIR(mode): |
74 | yield (child_path_decoded, |
75 | @@ -1168,7 +1170,7 @@ |
76 | self._ensure_versioned_dir(posixpath.dirname(dirname)) |
77 | self._versioned_dirs.add(dirname) |
78 | |
79 | - def path2id(self, path): |
80 | + def _path2id(self, path): |
81 | with self.lock_read(): |
82 | path = path.rstrip('/') |
83 | if self.is_versioned(path.rstrip('/')): |
84 | @@ -1399,14 +1401,14 @@ |
85 | for (dir_path, dir_ie) in self._add_missing_parent_ids( |
86 | parent, dir_ids): |
87 | ret[(posixpath.dirname(dir_path), dir_path)] = dir_ie |
88 | - file_ie.parent_id = self.path2id(parent) |
89 | + file_ie.parent_id = self._path2id(parent) |
90 | ret[(posixpath.dirname(path), path)] = file_ie |
91 | # Special casing for directories |
92 | if specific_files: |
93 | for path in specific_files: |
94 | key = (posixpath.dirname(path), path) |
95 | if key not in ret and self.is_versioned(path): |
96 | - ret[key] = self._get_dir_ie(path, self.path2id(key[0])) |
97 | + ret[key] = self._get_dir_ie(path, self._path2id(key[0])) |
98 | return ((path, ie) for ((_, path), ie) in sorted(ret.items())) |
99 | |
100 | def iter_references(self): |
101 | @@ -1417,7 +1419,7 @@ |
102 | yield path |
103 | |
104 | def _get_dir_ie(self, path, parent_id): |
105 | - file_id = self.path2id(path) |
106 | + file_id = self._path2id(path) |
107 | return GitTreeDirectory(file_id, |
108 | posixpath.basename(path).strip("/"), parent_id) |
109 | |
110 | @@ -1428,7 +1430,7 @@ |
111 | raise TypeError(path) |
112 | if not isinstance(value, tuple) and not isinstance(value, IndexEntry): |
113 | raise TypeError(value) |
114 | - file_id = self.path2id(path) |
115 | + file_id = self._path2id(path) |
116 | if not isinstance(file_id, bytes): |
117 | raise TypeError(file_id) |
118 | kind = mode_kind(value.mode) |
119 | |
120 | === modified file 'breezy/git/workingtree.py' |
121 | --- breezy/git/workingtree.py 2022-08-22 18:19:46 +0000 |
122 | +++ breezy/git/workingtree.py 2022-10-27 10:45:09 +0000 |
123 | @@ -538,7 +538,7 @@ |
124 | return |
125 | if action is not None: |
126 | parent_path = posixpath.dirname(filepath) |
127 | - parent_id = self.path2id(parent_path) |
128 | + parent_id = self._path2id(parent_path) |
129 | parent_ie = self._get_dir_ie(parent_path, parent_id) |
130 | file_id = action(self, parent_ie, filepath, kind) |
131 | if file_id is not None: |
132 | @@ -872,14 +872,14 @@ |
133 | parent, dir_ids): |
134 | pass |
135 | if kind == 'tree-reference' and recurse_nested: |
136 | - ie = self._get_dir_ie(path, self.path2id(path)) |
137 | + ie = self._get_dir_ie(path, self._path2id(path)) |
138 | yield (posixpath.relpath(path, from_dir), 'V', 'directory', |
139 | ie) |
140 | continue |
141 | if kind == 'directory': |
142 | if path != from_dir: |
143 | if self._has_dir(encoded_path): |
144 | - ie = self._get_dir_ie(path, self.path2id(path)) |
145 | + ie = self._get_dir_ie(path, self._path2id(path)) |
146 | status = "V" |
147 | elif self.is_ignored(path): |
148 | status = "I" |
149 | @@ -920,7 +920,7 @@ |
150 | def iter_child_entries(self, path): |
151 | encoded_path = encode_git_path(path) |
152 | with self.lock_read(): |
153 | - parent_id = self.path2id(path) |
154 | + parent_id = self._path2id(path) |
155 | found_any = False |
156 | for item_path, value in self.index.iteritems(): |
157 | decoded_item_path = decode_git_path(item_path) |
158 | @@ -1114,7 +1114,7 @@ |
159 | prefix = encode_git_path(prefix) |
160 | per_dir = defaultdict(set) |
161 | if prefix == b"": |
162 | - per_dir[(u'', self.path2id(''))] = set() |
163 | + per_dir[(u'', self._path2id(''))] = set() |
164 | |
165 | def add_entry(path, kind): |
166 | if path == b'' or not path.startswith(prefix): |
167 | @@ -1122,13 +1122,13 @@ |
168 | (dirname, child_name) = posixpath.split(path) |
169 | add_entry(dirname, 'directory') |
170 | dirname = decode_git_path(dirname) |
171 | - dir_file_id = self.path2id(dirname) |
172 | + dir_file_id = self._path2id(dirname) |
173 | if not isinstance(value, (tuple, IndexEntry)): |
174 | raise ValueError(value) |
175 | per_dir[(dirname, dir_file_id)].add( |
176 | (decode_git_path(path), decode_git_path(child_name), |
177 | kind, None, |
178 | - self.path2id(decode_git_path(path)), |
179 | + self._path2id(decode_git_path(path)), |
180 | kind)) |
181 | with self.lock_read(): |
182 | for path, value in self.index.iteritems(): |
183 | |
184 | === modified file 'breezy/tests/matchers.py' |
185 | --- breezy/tests/matchers.py 2021-11-13 21:30:35 +0000 |
186 | +++ breezy/tests/matchers.py 2022-10-27 10:45:09 +0000 |
187 | @@ -317,10 +317,12 @@ |
188 | def match(self, actual): |
189 | from ..bzr.inventorytree import InventoryTreeChange |
190 | actual = list(actual) |
191 | - if self.use_inventory_tree_changes or (actual and isinstance(actual[0], InventoryTreeChange)): |
192 | + if self.use_inventory_tree_changes: |
193 | expected = self._convert_to_inventory_tree_changes(self.old_tree, self.new_tree, self.expected) |
194 | else: |
195 | expected = self.expected |
196 | if self.use_inventory_tree_changes: |
197 | actual = self._convert_to_inventory_tree_changes(self.old_tree, self.new_tree, actual) |
198 | + elif actual and isinstance(actual[0], InventoryTreeChange): |
199 | + actual = [TreeChange(**{f: getattr(x, f) for f in TreeChange.__slots__}) for x in actual] |
200 | return Equals(expected).match(actual) |
201 | |
202 | === modified file 'breezy/tests/per_repository/test_commit_builder.py' |
203 | --- breezy/tests/per_repository/test_commit_builder.py 2021-12-25 12:35:22 +0000 |
204 | +++ breezy/tests/per_repository/test_commit_builder.py 2022-10-27 10:45:09 +0000 |
205 | @@ -26,6 +26,7 @@ |
206 | revision as _mod_revision, |
207 | tests, |
208 | ) |
209 | +from breezy.tree import TreeChange |
210 | from breezy.bzr import ( |
211 | inventorytree, |
212 | ) |
213 | @@ -190,20 +191,33 @@ |
214 | tree = self.make_branch_and_tree(".") |
215 | self.build_tree(["foo"]) |
216 | tree.add(["foo"]) |
217 | - foo_id = tree.path2id('foo') |
218 | rev_id = tree.commit("added foo") |
219 | with tree.lock_write(): |
220 | builder = tree.branch.get_commit_builder([rev_id]) |
221 | try: |
222 | - delete_change = InventoryTreeChange( |
223 | - foo_id, ('foo', None), True, (True, False), |
224 | - (tree.path2id(''), None), |
225 | - ('foo', None), ('file', None), |
226 | - (False, None)) |
227 | - list(builder.record_iter_changes(tree, rev_id, |
228 | - [delete_change])) |
229 | - self.assertEqual(("foo", None, foo_id, None), |
230 | - builder.get_basis_delta()[0]) |
231 | + if tree.supports_file_ids: |
232 | + foo_id = tree.path2id('foo') |
233 | + delete_change = InventoryTreeChange( |
234 | + foo_id, ('foo', None), True, (True, False), |
235 | + (tree.path2id(''), None), |
236 | + ('foo', None), ('file', None), |
237 | + (False, None)) |
238 | + list(builder.record_iter_changes(tree, rev_id, |
239 | + [delete_change])) |
240 | + self.assertEqual(("foo", None, foo_id, None), |
241 | + builder.get_basis_delta()[0]) |
242 | + |
243 | + else: |
244 | + delete_change = TreeChange( |
245 | + ('foo', None), True, (True, False), |
246 | + ('foo', None), ('file', None), (False, None)) |
247 | + foo_id = None |
248 | + list(builder.record_iter_changes(tree, rev_id, |
249 | + [delete_change])) |
250 | + (oldpath, newpath, file_id, entry) = builder.get_basis_delta()[0] |
251 | + self.assertEqual("foo", oldpath) |
252 | + self.assertIs(None, newpath) |
253 | + self.assertIs(None, entry) |
254 | self.assertTrue(builder.any_changes()) |
255 | builder.finish_inventory() |
256 | rev_id2 = builder.commit('delete foo') |
There was nothing to merge /ci.breezy- vcs.org/ job/brz/ job/brz- land/1043/
https:/