163
164
# The state should already be write locked, since we just had to do
164
165
# some operation to get here.
165
assert state._lock_token is not None
166
self.assertTrue(state._lock_token is not None)
167
168
self.assertEqual(expected_result[0], state.get_parent_ids())
168
169
# there should be no ghosts in this tree.
2054
2055
# the end it would still be fairly arbitrary, and we don't want the
2055
2056
# extra overhead if we can avoid it. So sort everything to make sure
2056
2057
# equality is true
2057
assert len(map_keys) == len(paths)
2058
self.assertEqual(len(map_keys), len(paths))
2059
2060
for path, keys in zip(paths, map_keys):
2060
2061
if keys is None:
2079
2080
:param paths: A list of directories
2081
2082
result = state._bisect_dirblocks(paths)
2082
assert len(map_keys) == len(paths)
2083
self.assertEqual(len(map_keys), len(paths))
2085
2085
for path, keys in zip(paths, map_keys):
2086
2086
if keys is None:
2515
2515
state._discard_merge_parents()
2516
2516
state._validate()
2517
2517
self.assertEqual(exp_dirblocks, state._dirblocks)
2520
class Test_InvEntryToDetails(TestCaseWithDirState):
2522
def assertDetails(self, expected, inv_entry):
2523
details = dirstate.DirState._inv_entry_to_details(inv_entry)
2524
self.assertEqual(expected, details)
2525
# details should always allow join() and always be a plain str when
2527
(minikind, fingerprint, size, executable, tree_data) = details
2528
self.assertIsInstance(minikind, str)
2529
self.assertIsInstance(fingerprint, str)
2530
self.assertIsInstance(tree_data, str)
2532
def test_unicode_symlink(self):
2533
# In general, the code base doesn't support a target that contains
2534
# non-ascii characters. So we just assert tha
2535
inv_entry = inventory.InventoryLink('link-file-id', 'name',
2537
inv_entry.revision = 'link-revision-id'
2538
inv_entry.symlink_target = u'link-target'
2539
details = self.assertDetails(('l', 'link-target', 0, False,
2540
'link-revision-id'), inv_entry)