Rev 5879: Update the test suite to handle root changes. 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 13:22:15 UTC 2011


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

------------------------------------------------------------
revno: 5879
revision-id: john at arbash-meinel.com-20110519132206-iy5aqsz54j7dhp2i
parent: john at arbash-meinel.com-20110519131417-zm5dp7gvtcjujk9y
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 15:22:06 +0200
message:
  Update the test suite to handle root changes.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2011-05-19 12:54:58 +0000
+++ b/bzrlib/tests/test_dirstate.py	2011-05-19 13:22:06 +0000
@@ -2469,6 +2469,13 @@
         dir_ids = {'': 'root-id'}
         inv = inventory.Inventory('root-id', rev_id)
         for path, file_id in shape:
+            if path == '':
+                # Replace the root entry
+                del inv._byid[inv.root.file_id]
+                inv.root.file_id = file_id
+                inv._byid[file_id] = inv.root
+                dir_ids[''] = file_id
+                continue
             inv.add(self.path_to_ie(path, file_id, rev_id, dir_ids))
         return revisiontree.InventoryRevisionTree(_Repo(), inv, rev_id)
 
@@ -2751,4 +2758,25 @@
             basis =[],
             delta=[(None, 'path/path2', 'file-id')])
 
-    # TODO: Test stuff like renaming a directory, and renaming contents therein
+    def test_change_root_id(self):
+        state = self.assertUpdate( # same as basis
+            active=[('', 'root-id'),
+                    ('file', 'file-id')],
+            basis= [('', 'root-id'),
+                    ('file', 'file-id')],
+            target=[('', 'target-root-id'),
+                    ('file', 'file-id')])
+        state = self.assertUpdate( # same as target
+            active=[('', 'target-root-id'),
+                    ('file', 'file-id')],
+            basis= [('', 'root-id'),
+                    ('file', 'file-id')],
+            target=[('', 'target-root-id'),
+                    ('file', 'root-id')])
+        state = self.assertUpdate( # all different
+            active=[('', 'active-root-id'),
+                    ('file', 'file-id')],
+            basis= [('', 'root-id'),
+                    ('file', 'file-id')],
+            target=[('', 'target-root-id'),
+                    ('file', 'root-id')])



More information about the bazaar-commits mailing list