Rev 5885: Removing the 'fast-path' for paths that look unchanged fixes the bug. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941

John Arbash Meinel john at arbash-meinel.com
Thu May 19 15:08:35 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941

------------------------------------------------------------
revno: 5885
revision-id: john at arbash-meinel.com-20110519150825-sp71o82yxs356qoi
parent: john at arbash-meinel.com-20110519150502-3twg6kmct21yeyxx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 17:08:25 +0200
message:
  Removing the 'fast-path' for paths that look unchanged fixes the bug.
  I'd like to do better than that, but we'll have to investigate.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2011-05-19 15:05:02 +0000
+++ b/bzrlib/dirstate.py	2011-05-19 15:08:25 +0000
@@ -1541,7 +1541,7 @@
                 new_ids.add(file_id)
             elif new_path is None:
                 deletes.append((old_path_utf8, None, file_id, None, True))
-            elif old_path == new_path:
+            elif (old_path, new_path) == root_only:
                 # change things in-place
                 changes.append((old_path_utf8, new_path_utf8, file_id,
                                 inv_to_entry(inv_entry)))
@@ -1844,6 +1844,7 @@
             for child_entry in dir_block:
                 child_basis_kind = child_entry[1][1][0]
                 if child_basis_kind not in 'ar':
+                    import pdb; pdb.set_trace()
                     self._raise_invalid(old_path, file_id,
                         "The file id was deleted but its children were "
                         "not deleted.")

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2011-05-19 15:02:58 +0000
+++ b/bzrlib/tests/test_dirstate.py	2011-05-19 15:08:25 +0000
@@ -2762,12 +2762,32 @@
         # We replace the parent directory, with another parent dir. But the C
         # file doesn't look like it has been moved.
         state = self.assertUpdate(# Same as basis
-            active=[('A/', 'A-id'),
-                    ('A/B', 'B-id')],
-            basis= [('A/', 'A-id'),
-                    ('A/B', 'B-id')],
-            target=[('A/', 'C-id'),
-                    ('A/B', 'B-id')])
+            active=[('dir/', 'A-id'),
+                    ('dir/B', 'B-id')],
+            basis= [('dir/', 'A-id'),
+                    ('dir/B', 'B-id')],
+            target=[('dir/', 'C-id'),
+                    ('dir/B', 'B-id')])
+        state = self.assertUpdate(# Same as target
+            active=[('dir/', 'C-id'),
+                    ('dir/B', 'B-id')],
+            basis= [('dir/', 'A-id'),
+                    ('dir/B', 'B-id')],
+            target=[('dir/', 'C-id'),
+                    ('dir/B', 'B-id')])
+        state = self.assertUpdate(# empty active
+            active=[],
+            basis= [('dir/', 'A-id'),
+                    ('dir/B', 'B-id')],
+            target=[('dir/', 'C-id'),
+                    ('dir/B', 'B-id')])
+        state = self.assertUpdate(# different active
+            active=[('dir/', 'D-id'),
+                    ('dir/B', 'B-id')],
+            basis= [('dir/', 'A-id'),
+                    ('dir/B', 'B-id')],
+            target=[('dir/', 'C-id'),
+                    ('dir/B', 'B-id')])
 
     def test_parent_child_swap(self):
         state = self.assertUpdate(# Same as basis



More information about the bazaar-commits mailing list