Rev 2473: Fix bug #111288. When we don't have a match in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/renamed_file_111288

John Arbash Meinel john at arbash-meinel.com
Mon Apr 30 18:29:52 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/renamed_file_111288

------------------------------------------------------------
revno: 2473
revision-id: john at arbash-meinel.com-20070430172939-hvjgsm1pinoawdy5
parent: pqm at pqm.ubuntu.com-20070430083158-pitv7lbgdu0q8g6h
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: renamed_file_111288
timestamp: Mon 2007-04-30 12:29:39 -0500
message:
  Fix bug #111288. When we don't have a match
  don't consider the disk file processed. Because we need to
  emit an 'unknown' record for it.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-04-30 07:48:55 +0000
+++ b/NEWS	2007-04-30 17:29:39 +0000
@@ -1,4 +1,10 @@
 IN DEVELOPMENT
+  
+  BUGFIXES:
+
+    * Handle when someone renames a file on disk without telling bzr.
+      Previously we would report the first file as missing, but not show
+      the new unknown file. (John Arbash Meinel, #111288)
 
 bzr 0.16rc2  2007-04-30
 

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2007-04-26 20:45:53 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2007-04-30 17:29:39 +0000
@@ -1354,3 +1354,34 @@
         self.assertEqual(expected,
                          self.do_iter_changes(tree1, tree2,
                                               want_unversioned=True))
+
+    def test_renamed_and_unknown(self):
+        """A file was moved on the filesystem, but not in bzr."""
+        tree1 = self.make_branch_and_tree('tree1')
+        tree2 = self.make_to_branch_and_tree('tree2')
+        root_id = tree1.get_root_id()
+        tree2.set_root_id(root_id)
+
+        # The final changes are:
+        # bzr add a b
+        # mv a a2
+
+        self.build_tree_contents([
+            ('tree1/a', 'a contents\n'),
+            ('tree1/b', 'b contents\n'),
+            ('tree2/a', 'a contents\n'),
+            ('tree2/b', 'b contents\n'),
+            ])
+        tree1.add(['a', 'b'], ['a-id', 'b-id'])
+        tree2.add(['a', 'b'], ['a-id', 'b-id'])
+        os.rename('tree2/a', 'tree2/a2')
+
+        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+
+        expected = sorted([
+            self.missing('a-id', 'a', 'a', tree2.get_root_id(), 'file'),
+            self.unversioned(tree2, 'a2'),
+            ])
+        self.assertEqual(expected,
+                         self.do_iter_changes(tree1, tree2,
+                                              want_unversioned=True))

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-04-30 05:13:58 +0000
+++ b/bzrlib/workingtree_4.py	2007-04-30 17:29:39 +0000
@@ -2268,7 +2268,7 @@
                                 # this check should probably be outside the loop: one
                                 # 'iterate two trees' api, and then _iter_changes filters
                                 # unchanged pairs. - RBC 20070226
-                                path_handled = True
+                                # path_handled = True
                                 if (include_unchanged
                                     or result[2]                    # content change
                                     or result[3][0] != result[3][1] # versioned status



More information about the bazaar-commits mailing list