Merge lp:~jelmer/brz/remove-more-file-ids into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/remove-more-file-ids
Merge into: lp:brz
Diff against target: 772 lines (+99/-119)
22 files modified
breezy/bundle/bundle_data.py (+1/-1)
breezy/bzr/inventorytree.py (+1/-1)
breezy/bzr/remote.py (+4/-4)
breezy/bzr/workingtree.py (+1/-1)
breezy/git/memorytree.py (+5/-5)
breezy/git/object_store.py (+12/-13)
breezy/git/remote.py (+2/-2)
breezy/git/tree.py (+1/-1)
breezy/hashcache.py (+1/-1)
breezy/memorytree.py (+12/-18)
breezy/merge.py (+19/-19)
breezy/mutabletree.py (+1/-1)
breezy/plugins/weave_fmt/test_repository.py (+1/-1)
breezy/tests/per_intertree/test_compare.py (+4/-8)
breezy/tests/per_repository_vf/test_repository.py (+4/-5)
breezy/tests/per_repository_vf/test_write_group.py (+1/-3)
breezy/tests/per_workingtree/test_parents.py (+4/-5)
breezy/tests/test_transform.py (+7/-7)
breezy/transform.py (+3/-5)
breezy/tree.py (+1/-4)
breezy/workingtree.py (+13/-13)
tools/win32/brz_postinstall.py (+1/-1)
To merge this branch: bzr merge lp:~jelmer/brz/remove-more-file-ids
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+358950@code.launchpad.net

Commit message

Stop actually accepting optional file_id in many Tree methods.

Description of the change

Stop actually accepting optional file_id in many Tree methods.

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

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/bundle/bundle_data.py'
2--- breezy/bundle/bundle_data.py 2018-11-16 18:33:17 +0000
3+++ breezy/bundle/bundle_data.py 2018-11-18 01:05:05 +0000
4@@ -682,7 +682,7 @@
5 old_path = self.old_path(path)
6 return self.base_tree.get_file_revision(old_path)
7
8- def get_size_and_sha1(self, new_path, file_id=None):
9+ def get_size_and_sha1(self, new_path):
10 """Return the size and sha1 hash of the given file id.
11 If the file was not locally modified, this is extracted
12 from the base_tree. Rather than re-reading the file.
13
14=== modified file 'breezy/bzr/inventorytree.py'
15--- breezy/bzr/inventorytree.py 2018-11-17 16:53:10 +0000
16+++ breezy/bzr/inventorytree.py 2018-11-18 01:05:05 +0000
17@@ -207,7 +207,7 @@
18 return self.root_inventory.iter_entries_by_dir(
19 specific_file_ids=inventory_file_ids)
20
21- def iter_child_entries(self, path, file_id=None):
22+ def iter_child_entries(self, path):
23 with self.lock_read():
24 ie = self._path2ie(path)
25 if ie.kind != 'directory':
26
27=== modified file 'breezy/bzr/remote.py'
28--- breezy/bzr/remote.py 2018-11-17 16:53:10 +0000
29+++ breezy/bzr/remote.py 2018-11-18 01:05:05 +0000
30@@ -961,23 +961,23 @@
31 format, name, root, subdir, force_mtime=force_mtime)
32 return ret
33
34- def annotate_iter(self, path, file_id=None,
35+ def annotate_iter(self, path,
36 default_revision=_mod_revision.CURRENT_REVISION):
37 """Return an iterator of revision_id, line tuples.
38
39 For working trees (and mutable trees in general), the special
40 revision_id 'current:' will be used for lines that are new in this
41 tree, e.g. uncommitted changes.
42- :param file_id: The file to produce an annotated version from
43 :param default_revision: For lines that don't match a basis, mark them
44 with this revision id. Not all implementations will make use of
45 this value.
46 """
47 ret = self._repository._annotate_file_revision(
48- self.get_revision_id(), path, file_id, default_revision)
49+ self.get_revision_id(), path, file_id=None,
50+ default_revision=default_revision)
51 if ret is None:
52 return super(RemoteInventoryTree, self).annotate_iter(
53- path, file_id, default_revision=default_revision)
54+ path, default_revision=default_revision)
55 return ret
56
57
58
59=== modified file 'breezy/bzr/workingtree.py'
60--- breezy/bzr/workingtree.py 2018-11-16 18:33:17 +0000
61+++ breezy/bzr/workingtree.py 2018-11-18 01:05:05 +0000
62@@ -1458,7 +1458,7 @@
63 # indeed dirty. - RBC 20060907
64 self._write_inventory(self._inventory)
65
66- def stored_kind(self, path, file_id=None):
67+ def stored_kind(self, path):
68 """See Tree.stored_kind"""
69 return self._path2ie(path).kind
70
71
72=== modified file 'breezy/git/memorytree.py'
73--- breezy/git/memorytree.py 2018-11-11 14:23:06 +0000
74+++ breezy/git/memorytree.py 2018-11-18 01:05:05 +0000
75@@ -73,7 +73,7 @@
76 if kinds[pos] is None:
77 kinds[pos] = self.kind(f)
78
79- def put_file_bytes_non_atomic(self, path, bytes, file_id=None):
80+ def put_file_bytes_non_atomic(self, path, bytes):
81 """See MutableTree.put_file_bytes_non_atomic."""
82 self._file_transport.put_bytes(path, bytes)
83
84@@ -192,14 +192,14 @@
85 raise AssertionError('unknown type %d' % stat_val.st_mode)
86 return index_entry_from_stat(stat_val, blob.id, 0)
87
88- def get_file_with_stat(self, path, file_id=None):
89- return (self.get_file(path, file_id), self._lstat(path))
90+ def get_file_with_stat(self, path):
91+ return (self.get_file(path), self._lstat(path))
92
93- def get_file(self, path, file_id=None):
94+ def get_file(self, path):
95 """See Tree.get_file."""
96 return self._file_transport.get(path)
97
98- def get_file_sha1(self, path, file_id=None, stat_value=None):
99+ def get_file_sha1(self, path, stat_value=None):
100 """See Tree.get_file_sha1()."""
101 stream = self._file_transport.get(path)
102 return osutils.sha_file(stream)
103
104=== modified file 'breezy/git/object_store.py'
105--- breezy/git/object_store.py 2018-11-16 18:33:17 +0000
106+++ breezy/git/object_store.py 2018-11-18 01:05:05 +0000
107@@ -235,17 +235,17 @@
108 except errors.NoSuchId:
109 pass
110 else:
111- pkind = ptree.kind(ppath, file_id)
112+ pkind = ptree.kind(ppath)
113 if kind == "file":
114 if (pkind == "file" and
115- ptree.get_file_sha1(ppath, file_id) == other):
116+ ptree.get_file_sha1(ppath) == other):
117 return (
118- file_id, ptree.get_file_revision(ppath, file_id))
119+ file_id, ptree.get_file_revision(ppath))
120 if kind == "symlink":
121 if (pkind == "symlink" and
122- ptree.get_symlink_target(ppath, file_id) == other):
123+ ptree.get_symlink_target(ppath) == other):
124 return (
125- file_id, ptree.get_file_revision(ppath, file_id))
126+ file_id, ptree.get_file_revision(ppath))
127 raise KeyError
128
129 # Find all the changed blobs
130@@ -254,7 +254,7 @@
131 if name[1] in BANNED_FILENAMES:
132 continue
133 if kind[1] == "file":
134- sha1 = tree.get_file_sha1(path[1], file_id)
135+ sha1 = tree.get_file_sha1(path[1])
136 blob_id = None
137 try:
138 (pfile_id, prevision) = find_unchanged_parent_ie(
139@@ -271,7 +271,7 @@
140 if not changed_content:
141 # no-change merge ?
142 blob = Blob()
143- blob.data = tree.get_file_text(path[1], file_id)
144+ blob.data = tree.get_file_text(path[1])
145 blob_id = blob.id
146 if blob_id is None:
147 new_blobs.append((path[1], file_id))
148@@ -282,7 +282,7 @@
149 ("blob", blob_id),
150 (file_id, tree.get_file_revision(path[1])), path[1])
151 elif kind[1] == "symlink":
152- target = tree.get_symlink_target(path[1], file_id)
153+ target = tree.get_symlink_target(path[1])
154 blob = symlink_to_blob(target)
155 shamap[path[1]] = blob.id
156 if add_cache_entry is not None:
157@@ -294,7 +294,7 @@
158 except KeyError:
159 if changed_content:
160 yield (path[1], blob,
161- (file_id, tree.get_file_revision(path[1], file_id)))
162+ (file_id, tree.get_file_revision(path[1])))
163 elif kind[1] is None:
164 shamap[path[1]] = None
165 elif kind[1] != 'directory':
166@@ -338,7 +338,7 @@
167 except KeyError:
168 # no-change merge ?
169 blob = Blob()
170- blob.data = tree.get_file_text(path, ie.file_id)
171+ blob.data = tree.get_file_text(path)
172 if add_cache_entry is not None:
173 add_cache_entry(blob, (ie.file_id, ie.revision), path)
174 return blob.id
175@@ -593,9 +593,8 @@
176 # Perhaps it's a symlink ?
177 tree = self.tree_cache.revision_tree(revision)
178 path = tree.id2path(file_id)
179- if tree.kind(path, file_id) == 'symlink':
180- blob = symlink_to_blob(
181- tree.get_symlink_target(path, file_id))
182+ if tree.kind(path) == 'symlink':
183+ blob = symlink_to_blob(tree.get_symlink_target(path))
184 _check_expected_sha(expected_sha, blob)
185 yield blob
186
187
188=== modified file 'breezy/git/remote.py'
189--- breezy/git/remote.py 2018-11-16 18:35:30 +0000
190+++ breezy/git/remote.py 2018-11-18 01:05:05 +0000
191@@ -816,13 +816,13 @@
192 f.seek(0)
193 return osutils.file_iterator(f)
194
195- def is_versioned(self, path, file_id=None):
196+ def is_versioned(self, path):
197 raise GitSmartRemoteNotSupported(self.is_versioned, self)
198
199 def has_filename(self, path):
200 raise GitSmartRemoteNotSupported(self.has_filename, self)
201
202- def get_file_text(self, path, file_id=None):
203+ def get_file_text(self, path):
204 raise GitSmartRemoteNotSupported(self.get_file_text, self)
205
206
207
208=== modified file 'breezy/git/tree.py'
209--- breezy/git/tree.py 2018-11-16 23:21:31 +0000
210+++ breezy/git/tree.py 2018-11-18 01:05:05 +0000
211@@ -461,7 +461,7 @@
212 file_id = self._fileid_map.lookup_file_id(path)
213 return GitTreeDirectory(file_id, posixpath.basename(path), parent_id)
214
215- def iter_child_entries(self, path, file_id=None):
216+ def iter_child_entries(self, path):
217 (store, mode, tree_sha) = self._lookup_path(path)
218
219 if mode is not None and not stat.S_ISDIR(mode):
220
221=== modified file 'breezy/hashcache.py'
222--- breezy/hashcache.py 2018-11-12 01:41:38 +0000
223+++ breezy/hashcache.py 2018-11-18 01:05:05 +0000
224@@ -173,7 +173,7 @@
225 if self._filter_provider is None:
226 filters = []
227 else:
228- filters = self._filter_provider(path=path, file_id=None)
229+ filters = self._filter_provider(path=path)
230 digest = self._really_sha1_file(abspath, filters)
231 elif stat.S_ISLNK(mode):
232 target = osutils.readlink(abspath)
233
234=== modified file 'breezy/memorytree.py'
235--- breezy/memorytree.py 2018-11-16 18:33:17 +0000
236+++ breezy/memorytree.py 2018-11-18 01:05:05 +0000
237@@ -85,11 +85,11 @@
238 missing files, so is a no-op.
239 """
240
241- def get_file(self, path, file_id=None):
242+ def get_file(self, path):
243 """See Tree.get_file."""
244 return self._file_transport.get(path)
245
246- def get_file_sha1(self, path, file_id=None, stat_value=None):
247+ def get_file_sha1(self, path, stat_value=None):
248 """See Tree.get_file_sha1()."""
249 stream = self._file_transport.get(path)
250 return sha_file(stream)
251@@ -147,9 +147,8 @@
252 def is_executable(self, path):
253 return self._inventory.get_entry_by_path(path).executable
254
255- def kind(self, path, file_id=None):
256- if file_id is None:
257- file_id = self.path2id(path)
258+ def kind(self, path):
259+ file_id = self.path2id(path)
260 return self._inventory[file_id].kind
261
262 def mkdir(self, path, file_id=None):
263@@ -234,7 +233,7 @@
264 else:
265 raise NotImplementedError(self._populate_from_branch)
266
267- def put_file_bytes_non_atomic(self, path, bytes, file_id=None):
268+ def put_file_bytes_non_atomic(self, path, bytes):
269 """See MutableTree.put_file_bytes_non_atomic."""
270 self._file_transport.put_bytes(path, bytes)
271
272@@ -256,7 +255,7 @@
273 else:
274 self._locks -= 1
275
276- def unversion(self, paths, file_ids=None):
277+ def unversion(self, paths):
278 """Remove the paths from the current versioned set.
279
280 When a file_id is unversioned, all of its children are automatically
281@@ -269,17 +268,12 @@
282 # XXX: This should be in mutabletree, but the inventory-save action
283 # is not relevant to memory tree. Until that is done in unlock by
284 # working tree, we cannot share the implementation.
285- if file_ids is None:
286- file_ids = set()
287- for path in paths:
288- file_id = self.path2id(path)
289- if file_id is None:
290- raise errors.NoSuchFile(path)
291- file_ids.add(file_id)
292- else:
293- for file_id in file_ids:
294- if not self._inventory.has_id(file_id):
295- raise errors.NoSuchId(self, file_id)
296+ file_ids = set()
297+ for path in paths:
298+ file_id = self.path2id(path)
299+ if file_id is None:
300+ raise errors.NoSuchFile(path)
301+ file_ids.add(file_id)
302 for file_id in file_ids:
303 if self._inventory.has_id(file_id):
304 self._inventory.remove_recursive_id(file_id)
305
306=== modified file 'breezy/merge.py'
307--- breezy/merge.py 2018-11-16 18:33:17 +0000
308+++ breezy/merge.py 2018-11-18 01:05:05 +0000
309@@ -250,17 +250,17 @@
310 @decorators.cachedproperty
311 def base_lines(self):
312 """The lines of the 'base' version of the file."""
313- return self._merger.get_lines(self._merger.base_tree, self.base_path, self.file_id)
314+ return self._merger.get_lines(self._merger.base_tree, self.base_path)
315
316 @decorators.cachedproperty
317 def this_lines(self):
318 """The lines of the 'this' version of the file."""
319- return self._merger.get_lines(self._merger.this_tree, self.this_path, self.file_id)
320+ return self._merger.get_lines(self._merger.this_tree, self.this_path)
321
322 @decorators.cachedproperty
323 def other_lines(self):
324 """The lines of the 'other' version of the file."""
325- return self._merger.get_lines(self._merger.other_tree, self.other_path, self.file_id)
326+ return self._merger.get_lines(self._merger.other_tree, self.other_path)
327
328
329 class Merger(object):
330@@ -1080,42 +1080,42 @@
331 self.working_tree.set_merge_modified(modified_hashes)
332
333 @staticmethod
334- def parent(entry, file_id):
335+ def parent(entry):
336 """Determine the parent for a file_id (used as a key method)"""
337 if entry is None:
338 return None
339 return entry.parent_id
340
341 @staticmethod
342- def name(entry, file_id):
343+ def name(entry):
344 """Determine the name for a file_id (used as a key method)"""
345 if entry is None:
346 return None
347 return entry.name
348
349 @staticmethod
350- def contents_sha1(tree, path, file_id=None):
351+ def contents_sha1(tree, path):
352 """Determine the sha1 of the file contents (used as a key method)."""
353 try:
354- return tree.get_file_sha1(path, file_id)
355+ return tree.get_file_sha1(path)
356 except errors.NoSuchFile:
357 return None
358
359 @staticmethod
360- def executable(tree, path, file_id=None):
361+ def executable(tree, path):
362 """Determine the executability of a file-id (used as a key method)."""
363 try:
364- if tree.kind(path, file_id) != "file":
365+ if tree.kind(path) != "file":
366 return False
367 except errors.NoSuchFile:
368 return None
369 return tree.is_executable(path)
370
371 @staticmethod
372- def kind(tree, path, file_id=None):
373+ def kind(tree, path):
374 """Determine the kind of a file-id (used as a key method)."""
375 try:
376- return tree.kind(path, file_id)
377+ return tree.kind(path)
378 except errors.NoSuchFile:
379 return None
380
381@@ -1400,7 +1400,7 @@
382 else:
383 return 'not_applicable', None
384
385- def get_lines(self, tree, path, file_id=None):
386+ def get_lines(self, tree, path):
387 """Return the lines in a file, or an empty list."""
388 if path is None:
389 return []
390@@ -1418,9 +1418,9 @@
391 # it's possible that we got here with base as a different type.
392 # if so, we just want two-way text conflicts.
393 base_path, other_path, this_path = paths
394- base_lines = self.get_lines(self.base_tree, base_path, file_id)
395- other_lines = self.get_lines(self.other_tree, other_path, file_id)
396- this_lines = self.get_lines(self.this_tree, this_path, file_id)
397+ base_lines = self.get_lines(self.base_tree, base_path)
398+ other_lines = self.get_lines(self.other_tree, other_path)
399+ this_lines = self.get_lines(self.this_tree, this_path)
400 m3 = merge3.Merge3(base_lines, this_lines, other_lines,
401 is_cherrypick=self.cherrypick)
402 start_marker = b"!START OF MERGE CONFLICT!" + b"I HOPE THIS IS UNIQUE"
403@@ -1703,7 +1703,7 @@
404
405 requires_file_merge_plan = False
406
407- def dump_file(self, temp_dir, name, tree, path, file_id=None):
408+ def dump_file(self, temp_dir, name, tree, path):
409 out_path = osutils.pathjoin(temp_dir, name)
410 with open(out_path, "wb") as out_file:
411 in_file = tree.get_file(path)
412@@ -1722,11 +1722,11 @@
413 try:
414 new_file = osutils.pathjoin(temp_dir, "new")
415 this = self.dump_file(
416- temp_dir, "this", self.this_tree, this_path, file_id)
417+ temp_dir, "this", self.this_tree, this_path)
418 base = self.dump_file(
419- temp_dir, "base", self.base_tree, base_path, file_id)
420+ temp_dir, "base", self.base_tree, base_path)
421 other = self.dump_file(
422- temp_dir, "other", self.other_tree, other_path, file_id)
423+ temp_dir, "other", self.other_tree, other_path)
424 status = breezy.patch.diff3(new_file, this, base, other)
425 if status not in (0, 1):
426 raise errors.BzrError("Unhandled diff3 exit code")
427
428=== modified file 'breezy/mutabletree.py'
429--- breezy/mutabletree.py 2018-11-16 18:33:17 +0000
430+++ breezy/mutabletree.py 2018-11-18 01:05:05 +0000
431@@ -304,7 +304,7 @@
432 :return: None
433 """
434
435- def put_file_bytes_non_atomic(self, path, bytes, file_id=None):
436+ def put_file_bytes_non_atomic(self, path, bytes):
437 """Update the content of a file in the tree.
438
439 Note that the file is written in-place rather than being
440
441=== modified file 'breezy/plugins/weave_fmt/test_repository.py'
442--- breezy/plugins/weave_fmt/test_repository.py 2018-11-11 04:08:32 +0000
443+++ breezy/plugins/weave_fmt/test_repository.py 2018-11-18 01:05:05 +0000
444@@ -143,7 +143,7 @@
445 control.create_branch()
446 tree = control.create_workingtree()
447 tree.add(['foo'], [b'Foo:Bar'], ['file'])
448- tree.put_file_bytes_non_atomic('foo', b'content\n', b'Foo:Bar')
449+ tree.put_file_bytes_non_atomic('foo', b'content\n')
450 try:
451 tree.commit('first post', rev_id=b'first')
452 except IllegalPath:
453
454=== modified file 'breezy/tests/per_intertree/test_compare.py'
455--- breezy/tests/per_intertree/test_compare.py 2018-11-11 04:08:32 +0000
456+++ breezy/tests/per_intertree/test_compare.py 2018-11-18 01:05:05 +0000
457@@ -805,15 +805,13 @@
458 tree1.mkdir('changing', b'parent-id')
459 tree1.mkdir('changing/unchanging', b'mid-id')
460 tree1.add(['changing/unchanging/file'], [b'file-id'], ['file'])
461- tree1.put_file_bytes_non_atomic(
462- 'changing/unchanging/file', b'a file', file_id=b'file-id')
463+ tree1.put_file_bytes_non_atomic('changing/unchanging/file', b'a file')
464 tree2 = self.make_to_branch_and_tree('2')
465 tree2.set_root_id(tree1.get_root_id())
466 tree2.mkdir('changed', b'parent-id')
467 tree2.mkdir('changed/unchanging', b'mid-id')
468 tree2.add(['changed/unchanging/file'], [b'file-id'], ['file'])
469- tree2.put_file_bytes_non_atomic(
470- 'changed/unchanging/file', b'changed content', file_id=b'file-id')
471+ tree2.put_file_bytes_non_atomic('changed/unchanging/file', b'changed content')
472 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
473 # parent-id has changed, as has file-id
474 root_id = tree1.path2id('')
475@@ -832,16 +830,14 @@
476 tree1.mkdir('changed', b'parent-id')
477 tree1.mkdir('changed/unchanging', b'mid-id')
478 tree1.add(['changed/unchanging/file'], [b'file-id'], ['file'])
479- tree1.put_file_bytes_non_atomic(
480- 'changed/unchanging/file', b'a file',
481- b'file-id')
482+ tree1.put_file_bytes_non_atomic('changed/unchanging/file', b'a file')
483 tree2 = self.make_to_branch_and_tree('2')
484 tree2.set_root_id(b'new')
485 tree2.mkdir('changed', b'parent-id')
486 tree2.mkdir('changed/unchanging', b'mid-id')
487 tree2.add(['changed/unchanging/file'], [b'file-id'], ['file'])
488 tree2.put_file_bytes_non_atomic(
489- 'changed/unchanging/file', b'changed content', file_id=b'file-id')
490+ 'changed/unchanging/file', b'changed content')
491 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
492 # old is gone, new is added, parent-id has changed(reparented), as has
493 # file-id(content)
494
495=== modified file 'breezy/tests/per_repository_vf/test_repository.py'
496--- breezy/tests/per_repository_vf/test_repository.py 2018-11-11 04:08:32 +0000
497+++ breezy/tests/per_repository_vf/test_repository.py 2018-11-18 01:05:05 +0000
498@@ -271,8 +271,7 @@
499 with tree.lock_write():
500 self.assertEqual(set(), set(repo.texts.keys()))
501 tree.add(['foo'], [file_id], ['file'])
502- tree.put_file_bytes_non_atomic(
503- 'foo', b'content\n', file_id=file_id)
504+ tree.put_file_bytes_non_atomic('foo', b'content\n')
505 try:
506 rev_key = (tree.commit("foo"),)
507 except errors.IllegalPath:
508@@ -293,16 +292,16 @@
509 repo.texts.get_parent_map(repo.texts.keys()))
510 tree2 = self.make_branch_and_tree('tree2')
511 tree2.pull(tree.branch)
512- tree2.put_file_bytes_non_atomic('foo', b'right\n', file_id=b'Foo:Bar')
513+ tree2.put_file_bytes_non_atomic('foo', b'right\n')
514 right_key = (tree2.commit('right'),)
515 keys.add(file_key + right_key)
516 parents[file_key + right_key] = (file_key + rev_key,)
517- tree.put_file_bytes_non_atomic('foo', b'left\n', file_id=b'Foo:Bar')
518+ tree.put_file_bytes_non_atomic('foo', b'left\n')
519 left_key = (tree.commit('left'),)
520 keys.add(file_key + left_key)
521 parents[file_key + left_key] = (file_key + rev_key,)
522 tree.merge_from_branch(tree2.branch)
523- tree.put_file_bytes_non_atomic('foo', b'merged\n', file_id=b'Foo:Bar')
524+ tree.put_file_bytes_non_atomic('foo', b'merged\n')
525 try:
526 tree.auto_resolve()
527 except errors.UnsupportedOperation:
528
529=== modified file 'breezy/tests/per_repository_vf/test_write_group.py'
530--- breezy/tests/per_repository_vf/test_write_group.py 2018-11-11 04:08:32 +0000
531+++ breezy/tests/per_repository_vf/test_write_group.py 2018-11-18 01:05:05 +0000
532@@ -70,9 +70,7 @@
533 tree.add([''], [b'TREE_ROOT'], ['directory'])
534 tree.add(['dir'], [b'dir-id'], ['directory'])
535 tree.add(['filename'], [b'file-id'], ['file'])
536- tree.put_file_bytes_non_atomic(
537- 'filename', b'content\n',
538- file_id=b'file-id')
539+ tree.put_file_bytes_non_atomic('filename', b'content\n')
540 tree.commit('Trunk commit', rev_id=b'rev-0')
541 tree.commit('Trunk commit', rev_id=b'rev-1')
542 tree.unlock()
543
544=== modified file 'breezy/tests/per_workingtree/test_parents.py'
545--- breezy/tests/per_workingtree/test_parents.py 2018-11-11 04:08:32 +0000
546+++ breezy/tests/per_workingtree/test_parents.py 2018-11-18 01:05:05 +0000
547@@ -442,16 +442,15 @@
548 self._repository = tree.branch.repository
549 self._inventory = shape
550
551- def get_file_text(self, path, file_id=None):
552- if file_id is None:
553- file_id = self.path2id(path)
554+ def get_file_text(self, path):
555+ file_id = self.path2id(path)
556 ie = self.root_inventory.get_entry(file_id)
557 if ie.kind != "file":
558 return b""
559 return b'a' * ie.text_size
560
561- def get_file(self, path, file_id=None):
562- return BytesIO(self.get_file_text(path, file_id))
563+ def get_file(self, path):
564+ return BytesIO(self.get_file_text(path))
565
566 with tree.lock_write():
567 if shape.root.revision is None:
568
569=== modified file 'breezy/tests/test_transform.py'
570--- breezy/tests/test_transform.py 2018-11-16 18:33:17 +0000
571+++ breezy/tests/test_transform.py 2018-11-18 01:05:05 +0000
572@@ -2094,16 +2094,16 @@
573 calls = []
574 real_source_get_file = source.get_file
575
576- def get_file(path, file_id=None):
577- calls.append(file_id)
578- return real_source_get_file(path, file_id)
579+ def get_file(path):
580+ calls.append(path)
581+ return real_source_get_file(path)
582 source.get_file = get_file
583 target = self.make_branch_and_tree('target')
584 revision_tree = source.basis_tree()
585 revision_tree.lock_read()
586 self.addCleanup(revision_tree.unlock)
587 build_tree(revision_tree, target, source)
588- self.assertEqual([b'file1-id'], calls)
589+ self.assertEqual(['file1'], calls)
590 target.lock_read()
591 self.addCleanup(target.unlock)
592 self.assertEqual([], list(target.iter_changes(revision_tree)))
593@@ -2147,9 +2147,9 @@
594 calls = []
595 real_source_get_file = source.get_file
596
597- def get_file(path, file_id=None):
598- calls.append(file_id)
599- return real_source_get_file(path, file_id)
600+ def get_file(path):
601+ calls.append(path)
602+ return real_source_get_file(path)
603 source.get_file = get_file
604 target = self.make_branch_and_tree('target')
605 revision_tree = source.basis_tree()
606
607=== modified file 'breezy/transform.py'
608--- breezy/transform.py 2018-11-16 23:21:31 +0000
609+++ breezy/transform.py 2018-11-18 01:05:05 +0000
610@@ -1796,8 +1796,7 @@
611 continue
612 kind = self.final_kind(trans_id)
613 if kind is None:
614- kind = self._tree.stored_kind(
615- self._tree.id2path(file_id), file_id)
616+ kind = self._tree.stored_kind(self._tree.id2path(file_id))
617 parent_trans_id = self.final_parent(trans_id)
618 parent_file_id = new_path_file_ids.get(parent_trans_id)
619 if parent_file_id is None:
620@@ -2167,8 +2166,7 @@
621 kind = self._transform.final_kind(trans_id)
622 if kind is None:
623 kind = self._transform._tree.stored_kind(
624- self._transform._tree.id2path(file_id),
625- file_id)
626+ self._transform._tree.id2path(file_id))
627 new_entry = inventory.make_entry(
628 kind,
629 self._transform.final_name(trans_id),
630@@ -2709,7 +2707,7 @@
631 tt.create_hardlink(accelerator_tree.abspath(accelerator_path),
632 trans_id)
633 else:
634- with accelerator_tree.get_file(accelerator_path, file_id) as f:
635+ with accelerator_tree.get_file(accelerator_path) as f:
636 chunks = osutils.file_iterator(f)
637 if wt.supports_content_filtering():
638 filters = wt._content_filter_stack(tree_path)
639
640=== modified file 'breezy/tree.py'
641--- breezy/tree.py 2018-11-16 18:40:46 +0000
642+++ breezy/tree.py 2018-11-18 01:05:05 +0000
643@@ -1352,25 +1352,22 @@
644 :return: The canonical path
645 """
646 # go walkin...
647- cur_id = tree.get_root_id()
648 cur_path = ''
649 bit_iter = iter(path.split("/"))
650 for elt in bit_iter:
651 lelt = normalize(elt)
652 new_path = None
653 try:
654- for child in tree.iter_child_entries(cur_path, cur_id):
655+ for child in tree.iter_child_entries(cur_path):
656 try:
657 if child.name == elt:
658 # if we found an exact match, we can stop now; if
659 # we found an approximate match we need to keep
660 # searching because there might be an exact match
661 # later.
662- cur_id = child.file_id
663 new_path = osutils.pathjoin(cur_path, child.name)
664 break
665 elif normalize(child.name) == lelt:
666- cur_id = child.file_id
667 new_path = osutils.pathjoin(cur_path, child.name)
668 except errors.NoSuchId:
669 # before a change is committed we can see this error...
670
671=== modified file 'breezy/workingtree.py'
672--- breezy/workingtree.py 2018-11-16 18:33:17 +0000
673+++ breezy/workingtree.py 2018-11-18 01:05:05 +0000
674@@ -362,10 +362,10 @@
675 def has_filename(self, filename):
676 return osutils.lexists(self.abspath(filename))
677
678- def get_file(self, path, file_id=None, filtered=True):
679- return self.get_file_with_stat(path, file_id, filtered=filtered)[0]
680+ def get_file(self, path, filtered=True):
681+ return self.get_file_with_stat(path, filtered=filtered)[0]
682
683- def get_file_with_stat(self, path, file_id=None, filtered=True,
684+ def get_file_with_stat(self, path, filtered=True,
685 _fstat=osutils.fstat):
686 """See Tree.get_file_with_stat."""
687 abspath = self.abspath(path)
688@@ -381,13 +381,13 @@
689 file_obj = _mod_filters.filtered_input_file(file_obj, filters)
690 return (file_obj, stat_value)
691
692- def get_file_text(self, path, file_id=None, filtered=True):
693- with self.get_file(path, file_id, filtered=filtered) as my_file:
694+ def get_file_text(self, path, filtered=True):
695+ with self.get_file(path, filtered=filtered) as my_file:
696 return my_file.read()
697
698- def get_file_lines(self, path, file_id=None, filtered=True):
699+ def get_file_lines(self, path, filtered=True):
700 """See Tree.get_file_lines()"""
701- with self.get_file(path, file_id, filtered=filtered) as file:
702+ with self.get_file(path, filtered=filtered) as file:
703 return file.readlines()
704
705 def get_parent_ids(self):
706@@ -456,7 +456,7 @@
707 new_parents = [revision_id]
708 tree.set_parent_ids(new_parents)
709
710- def get_file_size(self, path, file_id=None):
711+ def get_file_size(self, path):
712 """See Tree.get_file_size"""
713 # XXX: this returns the on-disk size; it should probably return the
714 # canonical size
715@@ -719,7 +719,7 @@
716 self.add(path, file_id, 'directory')
717 return file_id
718
719- def get_symlink_target(self, path, file_id=None):
720+ def get_symlink_target(self, path):
721 abspath = self.abspath(path)
722 target = osutils.readlink(abspath)
723 return target
724@@ -753,7 +753,7 @@
725 # checkout in a subdirectory. This can be avoided by not adding
726 # it. mbp 20070306
727
728- def extract(self, path, file_id=None, format=None):
729+ def extract(self, path, format=None):
730 """Extract a subtree from this tree.
731
732 A new branch will be created, relative to the path for this tree.
733@@ -764,7 +764,7 @@
734 """Write the in memory meta data to disk."""
735 raise NotImplementedError(self.flush)
736
737- def kind(self, relpath, file_id=None):
738+ def kind(self, relpath):
739 return osutils.file_kind(self.abspath(relpath))
740
741 def list_files(self, include_root=False, from_dir=None, recursive=True):
742@@ -900,7 +900,7 @@
743 self.set_parent_trees(parent_trees)
744 return count
745
746- def put_file_bytes_non_atomic(self, path, bytes, file_id=None):
747+ def put_file_bytes_non_atomic(self, path, bytes):
748 """See MutableTree.put_file_bytes_non_atomic."""
749 with self.lock_write(), open(self.abspath(path), 'wb') as stream:
750 stream.write(bytes)
751@@ -929,7 +929,7 @@
752 """
753 raise NotImplementedError(self.is_ignored)
754
755- def stored_kind(self, path, file_id=None):
756+ def stored_kind(self, path):
757 """See Tree.stored_kind"""
758 raise NotImplementedError(self.stored_kind)
759
760
761=== modified file 'tools/win32/brz_postinstall.py'
762--- tools/win32/brz_postinstall.py 2018-11-17 17:37:42 +0000
763+++ tools/win32/brz_postinstall.py 2018-11-18 01:05:05 +0000
764@@ -305,7 +305,7 @@
765 'EnvironmentError',
766 MB_OK | MB_ICONERROR)
767
768- if hkey not is None:
769+ if hkey is not None:
770 _winreg.SetValue(hkey, '', _winreg.REG_SZ, 'Brz Here')
771 hkey2 = _winreg.CreateKey(hkey, 'command')
772 _winreg.SetValue(hkey2, '', _winreg.REG_SZ,

Subscribers

People subscribed via source and target branches