2168
2168
This can be useful in debugging; it shouldn't be necessary in
2171
This must be called with a lock held.
2171
2173
from pprint import pformat
2174
# TODO: All entries should have the same length?
2172
2175
if len(self._dirblocks) > 0:
2173
2176
assert self._dirblocks[0][0] == '', \
2174
2177
"dirblocks don't start with root block:\n" + \
2193
2196
"dirblock for %r is not sorted:\n%s" % \
2194
2197
(dirblock[0], pformat(dirblock))
2199
# Make sure that all renamed entries point to the correct location.
2200
for entry in self._iter_entries():
2201
for tree_index, tree_state in enumerate(entry[1]):
2202
if tree_state[0] == 'r': # Renamed entry
2203
target_location = tree_state[1]
2204
other_entry = self._get_entry(tree_index,
2205
path_utf8=target_location)
2206
this_path = osutils.pathjoin(entry[0][0], entry[0][1])
2207
other_path = osutils.pathjoin(other_entry[0][0],
2209
assert entry[0][2] == other_entry[0][2], \
2210
('A rename entry points to a record with a different'
2211
' file id. %s => %s'
2212
% (pformat(entry), pformat(other_entry)))
2213
# there must be 'rename' pointers between all occurrences
2214
# of this file_id in all trees.
2216
# TODO: If there's only a single tree (no basis
2217
# revisions), there must not be any rename markers.
2219
# TODO: If there's more than 2 trees, we should still be
2220
# able to check that all the renames line up but it'll be
2223
# these are disabled because i think the assertions
2224
# they encode are wrong: there is no necessary link
2225
# between the rename pointers in one tree and in another.
2228
## if len(entry[1]) == 2: # Check the rename is symmetric
2229
## if tree_index == 0:
2233
## assert other_entry[1][other_index][0] == 'r', \
2234
## ('a rename points to a record which '
2235
## 'does not have a reverse rename pointer '
2237
## % (pformat(entry), pformat(other_entry)))
2238
## assert other_entry[1][other_index][1] == this_path, \
2239
## ('a rename points to a record which points to a'
2240
## ' different location.\n'
2243
## % (pformat(entry), pformat(other_entry),
2196
2246
def _wipe_state(self):
2197
2247
"""Forget all state information about the dirstate."""
2198
2248
self._header_state = DirState.NOT_IN_MEMORY