[MERGE][BUG #187169] rollback an invalid delta
John Arbash Meinel
john at arbash-meinel.com
Mon Feb 4 21:18:07 GMT 2008
This patch adds 2 updates to dirstate handling.
1) When we get into a bad state, set a flag so that the dirstate is
considered broken, and refuse to save it. This effectively rolls back
the state to the previously known good state.
This is partially because "update_basis_by_delta" (and
apply_inventory_delta) are designed to allow for an inconsistent state
in the middle of processing (rename A => B and B => A) as long as they
are consistent at the end.
I decided to go with a separate flag (self._consistency) rather than
another state in self._dirblock_state. Because there are a lot of places
that blindly set self._dirblock_state = IN_MEMORY_MODIFIED, and do so
blindly for performance reasons. I didn't want to have to change all of
those to check if it was corrupted, and then abort somehow.
2) When detecting an invalid delta, raise a real error rather than a
slightly customized BzrError.
I believe Robert didn't think they should be caught (which is
reasonable), but I did want to test them, so I created a real exception
class for them.
I'd like to see this land in 1.2. It doesn't completely fix the bug, as
commit will still generate an invalid delta. But it does help prevent
the dirstate from reaching an invalid state.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the bazaar