Rev 5873: _check_delta_ids_absent thought it didn't have to set _changes_aborted=True 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 11:13:39 UTC 2011


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

------------------------------------------------------------
revno: 5873
revision-id: john at arbash-meinel.com-20110519111330-j2cfilod2l3qympr
parent: john at arbash-meinel.com-20110519110825-bfdizt740uglh684
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 13:13:30 +0200
message:
  _check_delta_ids_absent thought it didn't have to set _changes_aborted=True
  but it really does. Because we may have called _*apply_deletes first, as
  part of splitting up renames into delete+add pairs.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2011-05-19 11:08:25 +0000
+++ b/bzrlib/dirstate.py	2011-05-19 11:13:30 +0000
@@ -1634,10 +1634,7 @@
                 if entry[0][2] != file_id:
                     # Different file_id, so not what we want.
                     continue
-                # NB: No changes made before this helper is called, so no need
-                # to set the _changes_aborted flag.
-                raise errors.InconsistentDelta(
-                    ("%s/%s" % key[0:2]).decode('utf8'), file_id,
+                self._raise_invalid(("%s/%s" % key[0:2]).decode('utf8'), file_id,
                     "This file_id is new in the delta but already present in "
                     "the target")
 

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2011-05-19 11:08:25 +0000
+++ b/bzrlib/tests/test_dirstate.py	2011-05-19 11:13:30 +0000
@@ -2543,12 +2543,12 @@
             [('basis', basis_tree)], [])
         self.assertRaises(errors.InconsistentDelta,
             state.update_basis_by_delta, inv_delta, 'target')
-        # try:
-        #     state.update_basis_by_delta(inv_delta, 'target')
-        # except errors.InconsistentDelta, e:
-        #     pass
-        # else:
-        #     import pdb; pdb.set_trace()
+        ## try:
+        ##     state.update_basis_by_delta(inv_delta, 'target')
+        ## except errors.InconsistentDelta, e:
+        ##     import pdb; pdb.set_trace()
+        ## else:
+        ##     import pdb; pdb.set_trace()
         self.assertTrue(state._changes_aborted)
 
     def test_remove_file_matching_active_state(self):
@@ -2687,4 +2687,10 @@
             basis= [('file', 'file-id-2')],
             delta=[(None, 'file', 'file-id')])
 
+    def test_invalid_repeated_id(self):
+        state = self.assertBadDelta(
+            active=[('file', 'file-id')],
+            basis= [('file', 'file-id')],
+            delta=[(None, 'file', 'file-id')])
+
     # TODO: Test stuff like renaming a directory, and renaming contents therein



More information about the bazaar-commits mailing list