Merge lp:~wgrant/bzr-git/lp-fixes-caching-hackery into lp:bzr-git

Proposed by William Grant
Status: Work in progress
Proposed branch: lp:~wgrant/bzr-git/lp-fixes-caching-hackery
Merge into: lp:bzr-git
Diff against target: 84 lines (+36/-2) (has conflicts)
1 file modified
object_store.py (+36/-2)
Text conflict in object_store.py
To merge this branch: bzr merge lp:~wgrant/bzr-git/lp-fixes-caching-hackery
Reviewer Review Type Date Requested Status
bzr-git developers Pending
Review via email: mp+307384@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

1634. By William Grant

Hack in _tree_to_objects to force-cache blobs that somehow skipped the cache. Big performance win.

1633. By William Grant

Correctness/crash fixes for lp:launchpad bzr -> git conversion, apparently fixing bug #818318.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'object_store.py'
2--- object_store.py 2015-05-09 00:38:40 +0000
3+++ object_store.py 2016-10-02 12:12:04 +0000
4@@ -163,7 +163,7 @@
5
6
7 def _tree_to_objects(tree, parent_trees, idmap, unusual_modes,
8- dummy_file_name=None):
9+ dummy_file_name=None, updater=None):
10 """Iterate over the objects that were introduced in a revision.
11
12 :param idmap: id map
13@@ -228,7 +228,15 @@
14 find_unchanged_parent_ie(file_id, kind[1], target, other_parent_trees)
15 except KeyError:
16 yield path[1], blob, (file_id, tree.get_file_revision(file_id, path[1]))
17+<<<<<<< TREE
18 elif kind[1] not in (None, "directory"):
19+=======
20+ new_trees[posixpath.dirname(path[1])] = parent[1]
21+ elif kind[1] == "directory":
22+ if parent[1] is not None:
23+ new_trees[posixpath.dirname(path[1])] = parent[1]
24+ elif kind[1] != None:
25+>>>>>>> MERGE-SOURCE
26 raise AssertionError(kind[1])
27 for p in parent:
28 if p and tree.has_id(p) and tree.kind(p) == "directory":
29@@ -254,6 +262,7 @@
30 inv = tree.inventory
31
32 trees = {}
33+<<<<<<< TREE
34 while dirty_dirs:
35 new_dirs = set()
36 for file_id in dirty_dirs:
37@@ -264,6 +273,21 @@
38 if ie.parent_id is not None:
39 new_dirs.add(ie.parent_id)
40 dirty_dirs = new_dirs
41+=======
42+ while new_trees:
43+ items = new_trees.items()
44+ new_trees = {}
45+ for path, file_id in items:
46+ if path != "":
47+ parent_path = urlutils.dirname(path)
48+ parent_id = tree.path2id(parent_path)
49+ # XXX wgrant 2015-05-06: Do we need to do something with
50+ # non-existent parents?
51+ if parent_id is None:
52+ continue
53+ new_trees[parent_path] = parent_id
54+ trees[path] = file_id
55+>>>>>>> MERGE-SOURCE
56
57 def ie_to_hexsha(ie):
58 try:
59@@ -277,6 +301,15 @@
60 # no-change merge ?
61 blob = Blob()
62 blob.data = tree.get_file_text(ie.file_id)
63+ if ie.kind == 'symlink':
64+ blob = symlink_to_blob(ie.symlink_target)
65+ # XXX: Sometimes objects don't get cached (the
66+ # InventoryFile gets a new revision without us
67+ # seeing a content_changed). To prevent that from
68+ # slowing down every subsequent revision, force it
69+ # into the cache now.
70+ if updater is not None:
71+ updater.add_object(blob, (ie.file_id, ie.revision), None)
72 return blob.id
73 elif ie.kind == "directory":
74 # Not all cache backends store the tree information,
75@@ -433,7 +466,8 @@
76 [p for p in rev.parent_ids if p in present_parents])
77 root_tree = None
78 for path, obj, bzr_key_data in _tree_to_objects(tree, parent_trees,
79- self._cache.idmap, unusual_modes, self.mapping.BZR_DUMMY_FILE):
80+ self._cache.idmap, unusual_modes, self.mapping.BZR_DUMMY_FILE,
81+ updater=self._get_updater(rev)):
82 if path == "":
83 root_tree = obj
84 root_key_data = bzr_key_data

Subscribers

People subscribed via source and target branches

to all changes: