Rev 2924: If THIS is considered renamed, _make_absent needs to remove the renamed target. in http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/bogus_removal_114615

John Arbash Meinel john at arbash-meinel.com
Tue Oct 23 20:45:32 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/bogus_removal_114615

------------------------------------------------------------
revno: 2924
revision-id:john at arbash-meinel.com-20071023194449-wb8fafx5unde63wq
parent: john at arbash-meinel.com-20071023181218-in3x181fnemz3vfj
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bogus_removal_114615
timestamp: Tue 2007-10-23 14:44:49 -0500
message:
  If THIS is considered renamed, _make_absent needs to remove the renamed target.
modified:
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2007-10-10 00:04:46 +0000
+++ b/bzrlib/dirstate.py	2007-10-23 19:44:49 +0000
@@ -1967,7 +1967,12 @@
         # build up paths that this id will be left at after the change is made,
         # so we can update their cross references in tree 0
         all_remaining_keys = set()
-        # Dont check the working tree, because it's going.
+        # If the working tree claims it is present, don't worry about it,
+        # because we are removing it. But if it is a rename, we need to remove
+        # the actual location.
+        details = current_old[1][0]
+        if details[0] == 'r':
+            all_remaining_keys.add(tuple(osutils.split(details[1])) + (current_old[0][2],))
         for details in current_old[1][1:]:
             if details[0] not in ('a', 'r'): # absent, relocated
                 all_remaining_keys.add(current_old[0])
@@ -1988,7 +1993,7 @@
             if self._id_index is not None:
                 self._id_index[current_old[0][2]].remove(current_old[0])
         # update all remaining keys for this id to record it as absent. The
-        # existing details may either be the record we are making as deleted
+        # existing details may either be the record we are marking as deleted
         # (if there were other trees with the id present at this path), or may
         # be relocations.
         for update_key in all_remaining_keys:
@@ -2000,6 +2005,10 @@
             assert present, 'could not find entry for %s' % (update_key,)
             update_tree_details = self._dirblocks[update_block_index][1][update_entry_index][1]
             # it must not be absent at the moment
+            # This doesn't seem to be strictly true, if you have a file renamed
+            # inside a directory, and you remove the directory
+            if update_tree_details[0][0] == 'a':
+                import pdb; pdb.set_trace()
             assert update_tree_details[0][0] != 'a' # absent
             update_tree_details[0] = DirState.NULL_PARENT_DETAILS
         self._dirblock_state = DirState.IN_MEMORY_MODIFIED



More information about the bazaar-commits mailing list