Rev 4738: Add a check in _validate that would have caught this bug. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-dirstate-set-root-504390

John Arbash Meinel john at arbash-meinel.com
Tue Jan 12 22:32:57 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-dirstate-set-root-504390

------------------------------------------------------------
revno: 4738
revision-id: john at arbash-meinel.com-20100112223234-8qh3pcfnscw25p1y
parent: john at arbash-meinel.com-20100112205545-s6s2m0xhdq971r8u
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-dirstate-set-root-504390
timestamp: Tue 2010-01-12 16:32:34 -0600
message:
  Add a check in _validate that would have caught this bug.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2010-01-12 20:51:58 +0000
+++ b/bzrlib/dirstate.py	2010-01-12 22:32:34 +0000
@@ -3013,6 +3013,13 @@
             if absent_positions == tree_count:
                 raise AssertionError(
                     "entry %r has no data for any tree." % (entry,))
+        if self._id_index is not None:
+            for file_id, entry_keys in self._id_index.iteritems():
+                for entry_key in entry_keys:
+                    if entry_key[2] != file_id:
+                        raise AssertionError(
+                            'file_id %r did not match entry key %s'
+                            % (file_id, entry_key))
 
     def _wipe_state(self):
         """Forget all state information about the dirstate."""



More information about the bazaar-commits mailing list