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
1=== modified file 'breezy/git/object_store.py'
2--- breezy/git/object_store.py 2019-06-16 16:12:56 +0000
3+++ breezy/git/object_store.py 2019-06-26 09:46:35 +0000
4@@ -42,6 +42,7 @@
5 osutils,
6 ui,
7 )
8+from ..tree import find_previous_path
9 from ..lock import LogicalLockResult
10 from ..revision import (
11 NULL_REVISION,
12@@ -228,24 +229,21 @@
13 base_tree = tree._repository.revision_tree(NULL_REVISION)
14 other_parent_trees = []
15
16- def find_unchanged_parent_ie(file_id, kind, other, parent_trees):
17+ def find_unchanged_parent_ie(path, kind, other, parent_trees):
18 for ptree in parent_trees:
19- try:
20- ppath = ptree.id2path(file_id)
21- except errors.NoSuchId:
22- pass
23- else:
24+ ppath = find_previous_path(tree, ptree, path)
25+ if ppath is not None:
26 pkind = ptree.kind(ppath)
27 if kind == "file":
28 if (pkind == "file" and
29 ptree.get_file_sha1(ppath) == other):
30 return (
31- file_id, ptree.get_file_revision(ppath))
32+ ptree.path2id(ppath), ptree.get_file_revision(ppath))
33 if kind == "symlink":
34 if (pkind == "symlink" and
35 ptree.get_symlink_target(ppath) == other):
36 return (
37- file_id, ptree.get_file_revision(ppath))
38+ ptree.path2id(ppath), ptree.get_file_revision(ppath))
39 raise KeyError
40
41 # Find all the changed blobs
42@@ -257,7 +255,7 @@
43 blob_id = None
44 try:
45 (pfile_id, prevision) = find_unchanged_parent_ie(
46- change.file_id, change.kind[1], sha1, other_parent_trees)
47+ change.path[1], change.kind[1], sha1, other_parent_trees)
48 except KeyError:
49 pass
50 else:
51@@ -290,7 +288,7 @@
52 blob, (change.file_id, tree.get_file_revision(change.path[1])), change.path[1])
53 try:
54 find_unchanged_parent_ie(
55- change.file_id, change.kind[1], target, other_parent_trees)
56+ change.path[1], change.kind[1], target, other_parent_trees)
57 except KeyError:
58 if change.changed_content:
59 yield (change.path[1], blob,

Subscribers

People subscribed via source and target branches