Rev 4544: Be more comprehensive about marking dirstate as changes aborted when exceptions are raised when errors are raised. in http://bazaar.launchpad.net/~lifeless/bzr/apply-inventory-delta

Robert Collins robertc at robertcollins.net
Fri Jul 17 03:16:47 BST 2009


At http://bazaar.launchpad.net/~lifeless/bzr/apply-inventory-delta

------------------------------------------------------------
revno: 4544
revision-id: robertc at robertcollins.net-20090717021643-lzkm6ij7u8yugshh
parent: robertc at robertcollins.net-20090717021123-s5gg4kje2g07qnio
committer: Robert Collins <robertc at robertcollins.net>
branch nick: apply-inventory-delta
timestamp: Fri 2009-07-17 12:16:43 +1000
message:
  Be more comprehensive about marking dirstate as changes aborted when exceptions are raised when errors are raised.
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2009-07-17 01:58:58 +0000
+++ b/bzrlib/dirstate.py	2009-07-17 02:16:43 +0000
@@ -1356,12 +1356,12 @@
             # Validate parents
             self._after_delta_check_parents(parents, 0)
         except errors.BzrError, e:
+            self._changes_aborted = True
             if 'integrity error' not in str(e):
                 raise
             # _get_entry raises BzrError when a request is inconsistent; we
             # want such errors to be shown as InconsistentDelta - and that 
             # fits the behaviour we trigger.
-            self._changes_aborted = True
             raise errors.InconsistentDeltaDelta(delta, "error from _get_entry.")
 
     def _apply_removals(self, removals):
@@ -1373,12 +1373,15 @@
             try:
                 entry = self._dirblocks[block_i][1][entry_i]
             except IndexError:
+                self._changes_aborted = True
                 raise errors.InconsistentDelta(path, file_id,
                     "Wrong path for old path.")
             if not f_present or entry[1][0][0] in 'ar':
+                self._changes_aborted = True
                 raise errors.InconsistentDelta(path, file_id,
                     "Wrong path for old path.")
             if file_id != entry[0][2]:
+                self._changes_aborted = True
                 raise errors.InconsistentDelta(path, file_id,
                     "Attempt to remove path has wrong id - found %r."
                     % entry[0][2])
@@ -1395,6 +1398,7 @@
                 # be due to it being in a parent tree, or a corrupt delta.
                 for child_entry in self._dirblocks[block_i][1]:
                     if child_entry[1][0][0] not in ('r', 'a'):
+                        self._changes_aborted = True
                         raise errors.InconsistentDelta(path, entry[0][2],
                             "The file id was deleted but its children were "
                             "not deleted.")
@@ -1405,6 +1409,7 @@
                 self.update_minimal(key, minikind, executable, fingerprint,
                                     path_utf8=path_utf8)
         except errors.NotVersionedError:
+            self._changes_aborted = True
             raise errors.InconsistentDelta(path_utf8.decode('utf8'), key[2],
                 "Missing parent")
 
@@ -1540,6 +1545,7 @@
             # Validate parents
             self._after_delta_check_parents(parents, 1)
         except errors.BzrError, e:
+            self._changes_aborted = True
             if 'integrity error' not in str(e):
                 raise
             # _get_entry raises BzrError when a request is inconsistent; we
@@ -1547,7 +1553,6 @@
             # fits the behaviour we trigger. Partof this is driven by dirstate
             # only supporting deltas that turn the basis into a closer fit to
             # the active tree.
-            self._changes_aborted = True
             raise errors.InconsistentDeltaDelta(delta, "error from _get_entry.")
 
         self._dirblock_state = DirState.IN_MEMORY_MODIFIED
@@ -1648,6 +1653,7 @@
         null = DirState.NULL_PARENT_DETAILS
         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")
             # the entry for this file_id must be in tree 1.
             dirname, basename = osutils.split(old_path)




More information about the bazaar-commits mailing list