Merge lp:~wgrant/bzr-git/tree-by-id into lp:bzr-git

Proposed by William Grant
Status: Merged
Approved by: Richard Wilbur
Approved revision: 1637
Merged at revision: 1632
Proposed branch: lp:~wgrant/bzr-git/tree-by-id
Merge into: lp:bzr-git
Diff against target: 113 lines (+24/-25)
3 files modified
NEWS (+3/-0)
object_store.py (+20/-23)
tests/test_push.py (+1/-2)
To merge this branch: bzr merge lp:~wgrant/bzr-git/tree-by-id
Reviewer Review Type Date Requested Status
Richard Wilbur Approve
Review via email: mp+258716@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Thanks for fixing the known failure!
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2015-05-08 02:22:21 +0000
+++ NEWS 2015-05-10 01:02:14 +0000
@@ -7,6 +7,9 @@
77
8 * Fix compatibility with and depend on dulwich 0.9.6. (William Grant)8 * Fix compatibility with and depend on dulwich 0.9.6. (William Grant)
99
10 * Correctly handle all moves when converting bzr trees to git.
11 (William Grant, #818318)
12
100.6.12 2013-09-22130.6.12 2013-09-22
1114
12 FEATURES15 FEATURES
1316
=== modified file 'object_store.py'
--- object_store.py 2013-08-21 04:02:54 +0000
+++ object_store.py 2015-05-10 01:02:14 +0000
@@ -173,7 +173,7 @@
173 in empty directories. None to skip empty directories173 in empty directories. None to skip empty directories
174 :return: Yields (path, object, ie) entries174 :return: Yields (path, object, ie) entries
175 """175 """
176 new_trees = {}176 dirty_dirs = set()
177 new_blobs = []177 new_blobs = []
178 shamap = {}178 shamap = {}
179 try:179 try:
@@ -219,7 +219,6 @@
219 shamap[file_id] = blob.id219 shamap[file_id] = blob.id
220 if not file_id in shamap:220 if not file_id in shamap:
221 new_blobs.append((path[1], file_id))221 new_blobs.append((path[1], file_id))
222 new_trees[posixpath.dirname(path[1])] = parent[1]
223 elif kind[1] == "symlink":222 elif kind[1] == "symlink":
224 if changed_content:223 if changed_content:
225 target = tree.get_symlink_target(file_id)224 target = tree.get_symlink_target(file_id)
@@ -229,14 +228,11 @@
229 find_unchanged_parent_ie(file_id, kind[1], target, other_parent_trees)228 find_unchanged_parent_ie(file_id, kind[1], target, other_parent_trees)
230 except KeyError:229 except KeyError:
231 yield path[1], blob, (file_id, tree.get_file_revision(file_id, path[1]))230 yield path[1], blob, (file_id, tree.get_file_revision(file_id, path[1]))
232 new_trees[posixpath.dirname(path[1])] = parent[1]
233 elif kind[1] not in (None, "directory"):231 elif kind[1] not in (None, "directory"):
234 raise AssertionError(kind[1])232 raise AssertionError(kind[1])
235 if (path[0] not in (None, "") and233 for p in parent:
236 tree.has_id(parent[0]) and234 if p and tree.has_id(p) and tree.kind(p) == "directory":
237 tree.kind(parent[0]) == "directory"):235 dirty_dirs.add(p)
238 # Removal
239 new_trees[posixpath.dirname(path[0])] = parent[0]
240236
241 # Fetch contents of the blobs that were changed237 # Fetch contents of the blobs that were changed
242 for (path, file_id), chunks in tree.iter_files_bytes(238 for (path, file_id), chunks in tree.iter_files_bytes(
@@ -250,18 +246,24 @@
250 parent_path = posixpath.dirname(path)246 parent_path = posixpath.dirname(path)
251 file_id = tree.path2id(parent_path)247 file_id = tree.path2id(parent_path)
252 assert file_id is not None, "Unable to find file id for %r" % parent_path248 assert file_id is not None, "Unable to find file id for %r" % parent_path
253 new_trees[parent_path] = file_id249 dirty_dirs.add(file_id)
250
251 try:
252 inv = tree.root_inventory
253 except AttributeError:
254 inv = tree.inventory
254255
255 trees = {}256 trees = {}
256 while new_trees:257 while dirty_dirs:
257 items = new_trees.items()258 new_dirs = set()
258 new_trees = {}259 for file_id in dirty_dirs:
259 for path, file_id in items:260 if file_id is None or not inv.has_id(file_id):
260 if path != "":261 continue
261 parent_path = urlutils.dirname(path)262 trees[inv.id2path(file_id)] = file_id
262 parent_id = tree.path2id(parent_path)263 ie = inv[file_id]
263 new_trees[parent_path] = parent_id264 if ie.parent_id is not None:
264 trees[path] = file_id265 new_dirs.add(ie.parent_id)
266 dirty_dirs = new_dirs
265267
266 def ie_to_hexsha(ie):268 def ie_to_hexsha(ie):
267 try:269 try:
@@ -287,11 +289,6 @@
287 else:289 else:
288 raise AssertionError290 raise AssertionError
289291
290 try:
291 inv = tree.root_inventory
292 except AttributeError:
293 inv = tree.inventory
294
295 for path in sorted(trees.keys(), reverse=True):292 for path in sorted(trees.keys(), reverse=True):
296 file_id = trees[path]293 file_id = trees[path]
297 assert tree.kind(file_id) == 'directory'294 assert tree.kind(file_id) == 'directory'
298295
=== modified file 'tests/test_push.py'
--- tests/test_push.py 2012-01-20 13:33:01 +0000
+++ tests/test_push.py 2015-05-10 01:02:14 +0000
@@ -109,8 +109,7 @@
109 commit = store[gitid]109 commit = store[gitid]
110 tree = store[commit.tree]110 tree = store[commit.tree]
111 tree.check()111 tree.check()
112 self.expectFailure("fails with KeyError (bug 818318)",112 self.assertTrue(tree["baz"][1] in store)
113 self.assertTrue, tree["baz"][1] in store)
114 baz = store[tree["baz"][1]]113 baz = store[tree["baz"][1]]
115 baz.check()114 baz.check()
116 ircdotnet = store[baz["IrcDotNet"][1]]115 ircdotnet = store[baz["IrcDotNet"][1]]

Subscribers

People subscribed via source and target branches

to all changes: