Rev 5868: We were raising exceptions improperly. A couple more tests cases, so far so good. 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 10:02:16 UTC 2011


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

------------------------------------------------------------
revno: 5868
revision-id: john at arbash-meinel.com-20110519100207-6xc2q4sz3301n2yc
parent: john at arbash-meinel.com-20110519095654-frxbnbw2q43bmc2j
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 12:02:07 +0200
message:
  We were raising exceptions improperly. A couple more tests cases, so far so good.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2011-05-19 09:56:54 +0000
+++ b/bzrlib/dirstate.py	2011-05-19 10:02:07 +0000
@@ -1687,7 +1687,7 @@
                     raise NotImplementedError()
                 else:
                     self._changes_aborted = True
-                    raise InconsistentDelta(new_path, file_id,
+                    raise errors.InconsistentDelta(new_path, file_id,
                         "An entry was marked as a new add"
                         " but the basis target already existed")
             else:
@@ -1722,7 +1722,7 @@
                         # We found a record, which was not *this* record,
                         # which matches the file_id, but is not actually
                         # present. Something seems *really* wrong.
-                        raise InconsistentDelta(new_path, file_id,
+                        raise errors.InconsistentDelta(new_path, file_id,
                             "We found a tree0 entry that doesnt make sense")
                     # Now, we've found a tree0 entry which matches the file_id
                     # but is at a different location. So update them to be
@@ -1779,7 +1779,7 @@
         for old_path, new_path, file_id, _, real_delete in deletes:
             if real_delete != (new_path is None):
                 self._changes_aborted = True
-                raise AssertionError("bad delete delta")
+                raise errors.InconsistentDelta("bad delete delta")
             # the entry for this file_id must be in tree 1.
             dirname, basename = osutils.split(old_path)
             block_index, entry_index, dir_present, file_present = \

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2011-05-19 09:56:54 +0000
+++ b/bzrlib/tests/test_dirstate.py	2011-05-19 10:02:07 +0000
@@ -2595,7 +2595,6 @@
             )
 
     def test_rename_file_active_state_has_diff_source_file(self):
-        import pdb; pdb.set_trace()
         state = self.assertUpdate(
             active=[('file', 'file-id-2')],
             basis =[('file', 'file-id')],
@@ -2608,3 +2607,21 @@
             basis =[('file', 'file-id')],
             target=[('other-file', 'file-id')],
             )
+
+    def test_rename_file_active_has_swapped_files(self):
+        state = self.assertUpdate(
+            active=[('file', 'file-id'),
+                    ('other-file', 'file-id-2')],
+            basis= [('file', 'file-id'),
+                    ('other-file', 'file-id-2')],
+            target=[('file', 'file-id-2'),
+                    ('other-file', 'file-id')])
+
+    def test_rename_file_basis_has_swapped_files(self):
+        state = self.assertUpdate(
+            active=[('file', 'file-id'),
+                    ('other-file', 'file-id-2')],
+            basis= [('file', 'file-id-2'),
+                    ('other-file', 'file-id')],
+            target=[('file', 'file-id'),
+                    ('other-file', 'file-id-2')])



More information about the bazaar-commits mailing list