Rev 6074: (jameinel) Fix bug #830947. Dirstate.set_root_id() should update the in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.4/
Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 23 08:17:46 UTC 2013
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.4/
------------------------------------------------------------
revno: 6074 [merge]
revision-id: pqm at pqm.ubuntu.com-20130523081746-2bsarcuxk0ihst5s
parent: pqm at pqm.ubuntu.com-20121106185552-58jmp21g8cxqsy16
parent: john at arbash-meinel.com-20130519114542-fllc0nqo0r33ia2p
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Thu 2013-05-23 08:17:46 +0000
message:
(jameinel) Fix bug #830947. Dirstate.set_root_id() should update the
id_index correctly.
The symptom is that if you have a tree with the file_id TREE_ROOT somewhere
other than at '',
it could cause 'bzr co' to fail because it tries to lookup the file in the
id_index map,
but it incorrectly points to a location ('') where the id never existed.
(John A Meinel)
modified:
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2011-09-28 15:41:38 +0000
+++ b/bzrlib/dirstate.py 2013-05-19 11:45:42 +0000
@@ -2609,13 +2609,6 @@
self.update_minimal(('', '', new_id), 'd',
path_utf8='', packed_stat=entry[1][0][4])
self._mark_modified()
- # XXX: This was added by Ian, we need to make sure there
- # are tests for it, because it isn't in bzr.dev TRUNK
- # It looks like the only place it is called is in setting the root
- # id of the tree. So probably we never had an _id_index when we
- # don't even have a root yet.
- if self._id_index is not None:
- self._add_to_id_index(self._id_index, entry[0])
def set_parent_trees(self, trees, ghosts):
"""Set the parent trees for the dirstate.
@@ -3328,10 +3321,20 @@
if self._id_index is not None:
for file_id, entry_keys in self._id_index.iteritems():
for entry_key in entry_keys:
+ # Check that the entry in the map is pointing to the same
+ # file_id
if entry_key[2] != file_id:
raise AssertionError(
'file_id %r did not match entry key %s'
% (file_id, entry_key))
+ # And that from this entry key, we can look up the original
+ # record
+ block_index, present = self._find_block_index_from_key(entry_key)
+ if not present:
+ raise AssertionError('missing block for entry key: %r', entry_key)
+ entry_index, present = self._find_entry_index(entry_key, self._dirblocks[block_index][1])
+ if not present:
+ raise AssertionError('missing entry for key: %r', entry_key)
if len(entry_keys) != len(set(entry_keys)):
raise AssertionError(
'id_index contained non-unique data for %s'
More information about the bazaar-commits
mailing list