Merge lp:~jelmer/brz/avoid-id2path-1 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/avoid-id2path-1
Merge into: lp:brz
Diff against target: 59 lines (+8/-10)
1 file modified
breezy/git/object_store.py (+8/-10)
To merge this branch: bzr merge lp:~jelmer/brz/avoid-id2path-1
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+369272@code.launchpad.net

Commit message

Avoid using id2path in breezy.git.

Description of the change

Avoid using id2path in breezy.git.

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
=== modified file 'breezy/git/object_store.py'
--- breezy/git/object_store.py 2019-06-16 16:12:56 +0000
+++ breezy/git/object_store.py 2019-06-26 09:46:35 +0000
@@ -42,6 +42,7 @@
42 osutils,42 osutils,
43 ui,43 ui,
44 )44 )
45from ..tree import find_previous_path
45from ..lock import LogicalLockResult46from ..lock import LogicalLockResult
46from ..revision import (47from ..revision import (
47 NULL_REVISION,48 NULL_REVISION,
@@ -228,24 +229,21 @@
228 base_tree = tree._repository.revision_tree(NULL_REVISION)229 base_tree = tree._repository.revision_tree(NULL_REVISION)
229 other_parent_trees = []230 other_parent_trees = []
230231
231 def find_unchanged_parent_ie(file_id, kind, other, parent_trees):232 def find_unchanged_parent_ie(path, kind, other, parent_trees):
232 for ptree in parent_trees:233 for ptree in parent_trees:
233 try:234 ppath = find_previous_path(tree, ptree, path)
234 ppath = ptree.id2path(file_id)235 if ppath is not None:
235 except errors.NoSuchId:
236 pass
237 else:
238 pkind = ptree.kind(ppath)236 pkind = ptree.kind(ppath)
239 if kind == "file":237 if kind == "file":
240 if (pkind == "file" and238 if (pkind == "file" and
241 ptree.get_file_sha1(ppath) == other):239 ptree.get_file_sha1(ppath) == other):
242 return (240 return (
243 file_id, ptree.get_file_revision(ppath))241 ptree.path2id(ppath), ptree.get_file_revision(ppath))
244 if kind == "symlink":242 if kind == "symlink":
245 if (pkind == "symlink" and243 if (pkind == "symlink" and
246 ptree.get_symlink_target(ppath) == other):244 ptree.get_symlink_target(ppath) == other):
247 return (245 return (
248 file_id, ptree.get_file_revision(ppath))246 ptree.path2id(ppath), ptree.get_file_revision(ppath))
249 raise KeyError247 raise KeyError
250248
251 # Find all the changed blobs249 # Find all the changed blobs
@@ -257,7 +255,7 @@
257 blob_id = None255 blob_id = None
258 try:256 try:
259 (pfile_id, prevision) = find_unchanged_parent_ie(257 (pfile_id, prevision) = find_unchanged_parent_ie(
260 change.file_id, change.kind[1], sha1, other_parent_trees)258 change.path[1], change.kind[1], sha1, other_parent_trees)
261 except KeyError:259 except KeyError:
262 pass260 pass
263 else:261 else:
@@ -290,7 +288,7 @@
290 blob, (change.file_id, tree.get_file_revision(change.path[1])), change.path[1])288 blob, (change.file_id, tree.get_file_revision(change.path[1])), change.path[1])
291 try:289 try:
292 find_unchanged_parent_ie(290 find_unchanged_parent_ie(
293 change.file_id, change.kind[1], target, other_parent_trees)291 change.path[1], change.kind[1], target, other_parent_trees)
294 except KeyError:292 except KeyError:
295 if change.changed_content:293 if change.changed_content:
296 yield (change.path[1], blob,294 yield (change.path[1], blob,

Subscribers

People subscribed via source and target branches