[MERGE] Inventory-free checkout

John Arbash Meinel john at arbash-meinel.com
Thu Jan 3 20:39:57 GMT 2008


John Arbash Meinel has voted tweak.
Status is now: Conditionally approved
Comment:
+    def _apply_removals(self, removals):
+        for path in sorted(removals, reverse=True):
+            dirname, basename = osutils.split(path)
+            block_i, entry_i, d_present, f_present = \
+                self._get_block_entry_index(dirname, basename, 0)
+            entry = self._dirblocks[block_i][1][entry_i]
+            entry[1][0] = ('a', '', 0, False, '')

^- I think apply_removals should be using "DirState._make_absent". As it 
handles when the removal is "permanent". (For example, renaming a file 2 
times, deleting a file which was just added, etc.)

At a minimum, we have DirState.NULL_PARENT_DETAILS, rather than 
duplicating that here.

_make_absent also handles updating the "_id_index" cache, and handling 
when the current record is actually renamed versus one of the parents. 
(deleting it in THIS needs to update the old location, rather than 
having a "renamed" link pointing to an "absent" record, the source 
location should be marked as "absent" in this.)

...
-        active_tree_ids = set((f for f in self._tree.inventory if
+        active_tree_ids = set((f for f in 
self._tree.iter_all_file_ids() if
                                 f not in removed_tree_ids))

^- This seems better written as:
active_tree_ids = set(self._tree.iter_all_file_ids())
active_tree_ids.difference_update(removed_tree_ids)

or even
active_tree_ids = set(self._tree.iter_all_file_ids()) - removed_tree_ids

I do wonder if "iter_all_file_ids()" is the best interface, given our 
recent concerns about 'iter' performance.

...
-    if len(wt.inventory) > 1:  # more than just a root
+    if len(list(wt)) > 1:  # more than just a root

^- It seems like there should be a better way to find out that we have 
 >=2 entries than building up a list of all 55k entries.

The biggest thing is using _make_absent to make sure all references are 
properly cleaned up, rather than just setting the field to 
NULL_PARENT_DETAILS

For details, see: 
http://bundlebuggy.aaronbentley.com/request/%3C47795B42.4000808%40aaronbentley.com%3E



More information about the bazaar mailing list